"Placement save fail: Duplicate entry '1604' for key 1"

The previous post was originally from 7/10/04. I moved it forward in an attempt to solve a MoveableType problem that generated the titular error message.

I got that message when trying to set categories; none of the categories for the most recent posts seemed to stick.

After digging around, I found out that the mt_placement table (MySQL version of MT) maps between entries and one or more categories. The reason the categories I was trying to assign wouldn't take was because MT couldn't write to that table for some reason.

Originally I thought this was an MT problem. I looked at the latest rows in the mt_entry and mt_placement tables, and I couldn't find a problem. I hit on the brilliant idea of trying to insert rows in mt_placement myself, when I got the error message from the MySQL client: "Duplicate entry '1604' for key 1"

Aha! It's not an MT problem, it's a MySQL problem.

First, I archived the current MySQL tables.

Then, I issued the following command in a MySQL window:

mysql>REPAIR TABLE mt_placement QUICK;

That solved the problem.