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!

Post the first comment:

I'll never share your email address and it won't be published.

What Is This?

davidgagne.net is the personal weblog of me, David Vincent Gagne. I've been publishing here since 1999, which makes this one of the oldest continuously-updated websites on the Internet.

bartender.live

A few years ago I was trying to determine what cocktails I could make with the alcohol I had at home. I searched the App Store but couldn't find an app that would let me do that, so I built one.

Hemingway

You can read dozens of essays and articles and find hundreds of links to other sites with stories and information about Ernest Hemingway in The Hemingway Collection.