It was a dark and stormy night.
I had a rebuild error in my individual archive template.
I yelled at my monitor, “What could it be?!”
I hadn’t modified that template in weeks! Something was wrong. And it was bad. I couldn’t rebuild all. Ack! What to do? I begged Ben for assistance.
“Help!” I cried in the night. “My rebuilds are failing and I don’t know why!”
Ben, our noble hero, assured me that my template was fine; there were no MT tags misplaced, no out-of-context container tags fouling my perl.
It seemed I was doomed. The error had to be in one of the entries. Gadzooks! How would I ever know which one? There are so many hundreds of entries in that blog! I’m sure by now you’re dying to know how I salvaged my sanity (and my individual entry archive rebuilding). I’ll tell you. But be warned! This trick may not work for you! Foul and evil consequences may result! Verify with a genius / Ben that your problem is *not* in your template code! Create back ups first! Eat more vegetables! I edited line 205 of MT/lib/MT.pm so that it would tell me the title of the entry that was failing. Change it from
return $mt->error(“Building entry failed: ” . $tmpl->errstr);
to
return $mt->error(“Building entry failed: ” . $entry->title);
and when you hit an entry that is killing your rebuild, it will tell you the title! w00t! Is MT great or what?
The problem was that someone (or several someones) had added comments to an entry and used – gasp! – invalid URLs and / or eMail addresses. Those stinking bastiches! I deleted their good-for-nothing comments and my rebuild executed like magic.
Yippee-ki-yay.
UPDATE: Ben (the genius that co-wrote MovableType) posted a message to the support forums with an even better fix! Change the line to
return $mt->error(“Building entry ‘” . $entry->title . “‘ failed: ” . $tmpl->errstr);
and you’ll get the error message and the Title. Excellent!