Skip to:

Not able to make new posts – database error

  • Hello,

    I’ve been running 0.9.4 for about six months now without major problems but today something happened. No new posts can be made and the following error displays:

    bbPress database error: [Duplicate entry '7582' for key 1]
    INSERT INTO bb_posts (<code>topic_id</code>,<code>post_text</code>,<code>post_time</code>,<code>poster_id</code>,<code>poster_ip</code>,<code>post_status</code>,<code>post_position</code>,<code>forum_id</code>) VALUES ('6','

    test post text text text text
    ','2009-05-25 11:56:28','3','','0','121','8')

    Warning: Cannot modify header information - headers already sent by (output started at /path-to-bbpress/bb-includes/db-mysql.php:130) in /path-to-bbpress/bb-includes/pluggable.php on line 232

    New posts get registered in the latest-discussions list but the link to them is “#post-0” and they don’t display in the actual topic, nor in the admin panels. They actually don’t exist in the DB.

    The last existing post in bb_posts is with post_id of 7581

    Luckily I have a working backup before the error occurred but I want to know what might have caused it.

Viewing 8 replies - 1 through 8 (of 8 total)

  • chrishajer


    Sounds like the auto_increment for the post_id got messed up? Can you look at the table in phpMyAdmin and see what the next auto_increment will be? Maybe you can reset it so there’s no conflict? I’ve never heard of this before, so I am just thinking about what I would do if it happened to me.

    I have heard of key problems like that after upgrading versions, but you say yours has been OK for a couple months, so it’s not likely to be related to that.

    what do you mean by “reseting”? How to do that?

    The last valid post_id is 7580 – after that things went wrong



    In phpMyAdmin you can see what the next autoincrement value is going to be for post_id. I would look at the posts and order them by post_id to see the highest, then I would see if the next autoincrement value is going to conflict with that. If it is, just reset the autoincrement value to something higher, even if you skip some values.

    You need something like phpMyAdmin or command-line mysql to take care of this. Do you have access to something like that?

    Yes, I have access to phpMyAdmin but did not really know how to fix it through there…

    I managed to automagically fix it with a WP plugin that manages the DB (cause I have WP and bbPress integrated). Now I can make new posts but the links to the erroneous(missing) posts still remain and recounting does not remove them.

    Anyway I think I will just use the backup DB. Just about 10-15 replies will be lost but it’s not a pain since nobody except their authors saw them because of the error.

    Thanks for the help!

    Argh! It happened again…! I wonder what’s causing it? A bad plugin?

    Or my not-so-good host server?



    I suspect a plugin; MySQL should not do that.

    Also, exactly WHAT did you do with the WordPress plugin? Sounds like that just allowed you to access the database, but then what?

    I fixed it with the popular WP DB-Manager plugin. I just used the options “Repair DB” and then “Optimize DB”.

    Here are the plugins I use which IMO might have smth to do with posting:

    Post Edit Look Behind

    Live Comment Preview

    bbPress signatures

    Ajaxed Quote

    HTML Tag Attributes Validator

    Related Topics

    BBcode Buttons Toolbar

    Post Count Plus

    bbpress SEO tools

    bbPress Polls

    Post Notification

    bb Topic Views

    BBcode Lite


    Forum Last Poster

    bbPress Smilies

    Things have been going fine for the last day so I hope it does not happen again :) And I’ve increased the backup frequency in case of an emergency.



    I believe the OPTIMIZE command in MySQL resets the auto_increment. If it happens again though, you need to figure out why. Maybe the “Post Edit Look Behind” plugin has something to do with it? I have no idea though, not having looked at that plugin. I would disable that first if it happens again.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar