We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44375
    • 92 Posts
    There are 4 articles in my MODx 2.2.10 system that when I click to edit in the manager, I get a 500 error:

    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

    They were working fine, as far as I'm aware nothing changed on these pages, they display fine on the front end. They are complex, in that they use Wayfinder to concatenate the resource itself with HTML from its children resources (which are then displayed in animated Javascript panels). It might have started when I installed VersionX. I've tried deleting the contents of the core/cache directory. There is nothing in the MODx manager error log. All other resources edit fine.

    Any idea how I can start to diagnose this?

    Huge thanks
    Chris
    • It is likely the specific content you are posting into that Resource. Many servers have mod_security or similar systems in place that block POST requests if they contain specific strings. This sounds like what might be going on in your case.
      • Aren't those usually when attempting to save the banned content, rather than when to fetch it? If he's getting the 500 error when attempting to open the resource for editing, then there is something else in play.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
        • Correct Susan, I must have not read it thoroughly. This may actually be the Gallery TV type still assigned to the Resource (or a similar situation).
          • I once got into this same situation. I had deleted a TV that I wasn't using any more, and every resource using the template that TV had been attached to was causing a 500 server error, whether I had edited the TV for the resource or not. I finally ended up duplicating the template and moving all of the resources to that new template. We never were able to figure out what the problem was. Nothing in the database, nothing in the cache had any sign of the TV or any connection to it, no error reports could be found.

            Afterwards, it occurred to me that it may have been a corrupted index in a database table, but by that time checking tables for needing repair didn't show anything wrong.

            So I would suggest first manually empty the cache (core/cache/), then check your database for tables that need repair. Also make sure that your browser's cache and cookies for the domain are cleared.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 3749
              • 24,544 Posts
              It could be an invalid modTemplateVarResource or modTemplateVarTemplate object.

              SiteCheck would report that: http://bobsguides.com/sitecheck-tutorial.html
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 44375
                • 92 Posts
                I've run the mysql repair utility on every table in the database, I've duplicated the template and assigned a couple of the documents to the new version of the template (using batcher - assume this'd fix modTemplateVarResource or modTemplateVarTemplate errors), deleting the cache manually inbetween each attempted fix and trying the edit action on an entirely new computer, let alone browser. Still getting the damn 500 error. mod-security isn't applied but anyway scans submissions as you highlight. Any other great ideas pretty please?
                  • 44375
                  • 92 Posts
                  PS. Nothing is appearing in the error log in the manager, and the log subdirectory in the cache directory isn't even being created.

                  Ideas on diagnosis at least as welcome as potential solutions thanks.
                    • 44375
                    • 92 Posts
                    PPS. It does seem to be the template, as Susan suggested.
                      • 44375
                      • 92 Posts
                      I've narrowed it down to a template variable, however I've hundreds of values entered for this particular template variable, so I'm trying to find the data error rather than replace the TV.

                      I ran:
                      repair table qstrv_site_content;
                      repair table qstrv_site_tmplvar_contentvalues;
                      repair table qstrv_site_tmplvar_templates;


                      (and every other table in the database)
                      I've tried deleting (DELETE FROM..) all the differences I can find in the above three tables (it had been populated for some other templates).
                      I've duplicated the template, dissociated the TV, saved, re-associated it, and assigned resources to the duplicate template
                      I've tried associating resources to the template THEN dissociating the TV, saving and re-associating the TV.

                      But when this TV is on the template or its duplicate, editing any resource on that template throws a 500 HTTP error. When this TV is on another template, no problem. Comparing before and after databases, these TV values were set previously on these resources on the original template without any problem. There are no duplicates for a given contentid. The TV is associated with the same templates as before. All that has changed is some values have been entered for resources on different templates. (Deleting these tmplvar_value rows doesn't help. Deleting the site_content rows doesn't either - through the MODx manager or in the database.)

                      qstrv_site_tmplvars.properties, input_properties and output_properties are NULL. qstrv_site_tmplvars.display is empty. I've tried populating them, doesn't help. qstrv_site_tmplvars.editor_type and static are zero.


                      Please could someone give me some inkling as to what could possibly cause editing to throw the 500 error? (Or anything else at all that might give me a shove towards resolution.)

                      The problem seems to have arisen when the users started populating the TV on templates other than the original one. The TV is associated with other templates but had not previously been populated.