Dealing with "Error rebuilding file ... : Publish error in template '... ': Unknown tag found: ..."

| No Comments | No TrackBacks |
A recent forum post asked about possible solutions for a Movable Type error that looked like this:

Error rebuilding file /var/www/...: Publish error in template '...': Error in tag: error in module...: Publish error in template '...': Error in tag: Error in tag: error in module ...: Publish error in template '...': Unknown tag found: ...

The weird thing was that the error only happened when publishing the particular file via the publish queue using the 'run-periodic-tasks' script, but it didn't happen when publishing the file 'by hand'.
First, a little more about the error message in question.  This particular type of error happens when Movable Type encounters a template tag that it doesn't recognize.  If the tag appears directly in an index or archive template, this template will be the only one named in the error message.  If the tag occurs in a template module that is being included in such a template, both the 'parent' and the 'child' template are named.  If the tag is in a module that is at the end of a chain of includes (for example when the main index includes a sidebar module that includes a links module which in turn includes a module listing a specifc type of link) all the modules in the chain will be named in the error.

This means the error message can become very long, but you shouldn't be worried about that too much: just look at the last module named in the list because that is the one where the problem actually is

The 'Unknown tag found' error can have two common causes.  
  • The first one is simply a typo: maybe you typed <mt:entrys> or <mt:bolgname> by accident, or you forgot to close the tag or maybe a quote is missing somewhere.
  • The other common cause is that the tag in question is supplied by a plugin and the plugin is not installed (or broken) on your installation.  In this case, check the activity log for clues and/or check the plugins screen to make sure the plugin is actually present.
Special case: if the plugin is installed, and publishing works if you do it manually but not if you use the publish queue, there might be something else going on.  The publish queue works by having an instance of the run-periodic-tasks script (found in the 'tools' folder of your MT installation) run on the server.  You can either run this script periodically (say, every minute or so), or you can make it run constantly, in daemon mode.  When the script is started, it loads all plugins MT would normally load and then starts working on all the publish jobs in the queue.  However, it only loads the plugins once, at startup.

So if you install a new plugin (or upgrade an old one), run-periodic-tasks doesn't know about that until it is restarted.  Especially in daemon mode this can be a problem because the same instance of the script might be running for hours or days on end.  In that case, run-periodic-tasks might end up not recognizing the new plugin-provided template tags you have been adding to your templates after installing the plugin, and you might begin to see error messages pop up in the activity log.

Fortunately, the solution is simple: just stop all instances of run-periodic-tasks and restart them.

No TrackBacks

TrackBack URL: http://www.movabletips.com/cgi-bin/mt/mt-tb.cgi/3195

Leave a comment