"user warning: Duplicate entry '11' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (11, 11, 'admin/settings/superteaser', 'superteaser', '', 0, 22) in /home/jennifer/public_html/includes/database.mysql.inc on line 120"

I get this error on several pages when saving settings, and I also get it each time I visit the "menus" admin page. Each time the error loads the duplicate entry number increments.

I think it might have something to do with my database clean-up. Before this happend, I emptied the following database tables before I made a backup:

Cache
Sessions
sequences
accesslog
watchdog

Any help would be appreciated.
JR

Comments

jurriaanroelofs’s picture

note:I can't add menu items because of this problem.

-------------------------------
http://www.sooperthemes.com/#-Drupal-Themes

brenda003’s picture

Ack! You should never clear the sequences table. That gives you the sequences of everything, node IDs, user IDs, menu IDs, etc. I hope you have a backup of this table that you can put back in there. Essentially, it's trying to create things using IDs already taken up.

jurriaanroelofs’s picture

damn it, should have made a full backup before I made a clean backup.
I think I somehow confused sequences with sessions or something.

The site I'm working on is pretty simple in it's structure and nearly done, I just need to create menu items, is there any way I can still do that? Maybe I can run through the number of entries that were in the table before, by refreshing the menu page, or does is not work that way?

Will this cause any more problems? The menu thing is not a fatal problem as I can get away with a hardcoded static menu in this case.

wth looks Like I've broken Drupal.org as well now:
[code]your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.#type = 'value' AND n.#value = '76315' in /var/www/drupal.org/htdocs/includes/database.mysql.inc on line 120

Warning: Invalid argument supplied for foreach() in /var/www/drupal.org/htdocs/modules/node.module on line 359

Warning: implode(): Bad arguments. in /var/www/drupal.org/htdocs/modules/node.module on line 363

Warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /var/www/drupal.org/htdocs/includes/database.mysql.inc on line 120

Warning: Invalid argument supplied for foreach() in /var/www/drupal.org/htdocs/modules/node.module on line 359

Warning: implode(): Bad arguments. in /var/www/drupal.org/htdocs/modules/node.module on line 363

Warning: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /var/www/drupal.org/htdocs/includes/database.mysql.inc on line 120[/code]

-------------------------------
http://www.sooperthemes.com/#-Drupal-Themes

brenda003’s picture

I was seeing those errors here on Drupal.org, too, don't think you did it. :P

You can fix the sequences table. Just pick a large enough number to start from again. I had a problem with sequences when I merged some databases, and just ended up resetting it all to large numbers. If you can get into your database, whichever method you choose (phpMyAdmin or what have you), and take a peek at the table you can just set all the IDs up to 100 or 1000, depending on how many menu items and other items you have. Although you may only be seeing a problem with the menus right now, if you create any more nodes or users, you'll have the same problem. So se those up, as well.

jurriaanroelofs’s picture

Thanks! that did the trick.

-------------------------------
http://www.sooperthemes.com/#-Drupal-Themes

ozlady’s picture

This fix worked for me - thanks!

sammyframson’s picture

Hi, thanks for posting this info. I have recently moved my Drupal 6 site to a new host and everything appeared to be working correctly EXCEPT... when I try to post a new menu entry in the primary navigation, i get a "successful" message but it does not show up in the menu table or in the navigation.

I can look at my DB tables but I am a serious novice when it comes to databases and I do not want to risk messing something up. I am not sure what is meant when it said to set ID's up to 100 or 1000 and wanted to see if someone could elaborate a bit for me on how I could solve this issue?

Thanks for any assistance!

Zachariah’s picture

user warning: Duplicate entry '74' for key 1 query: INSERT INTO menu (mid, pid, path, title, description, weight, type) VALUES (74, 1, 'gallery', 'Gallery', '', 0, 22) in /home/username/public_html/includes/database.mysql.inc on line 167.

I'm getting this error (found this thread via google)

Is the solution above what will help me, too?

Here's how I "caused" the error:

  • I installed Gallery2 and the gallery module into 5.x with no problems.
  • I edited the "Gallery" menu item so it was called "Photos" instead
  • I decided that since it wasn't going to change the page name to photos also, that I'd reset it
  • I clicked the reset button, and ever since there's been this error

I haven't changed anything else since.

(I can access the database via phpmyadmin)

My most recent backup before this is so old (1/2 day of heavy adding of content) that I'd rather not try to recreate all that content.

I really just want to eliminate the "duplicate" -- shouldn't eliminating a duplicate be pretty straight forward?

Zachariah’s picture

alright,

I changed menu_mid, node_nid, and node_revisions_vid all to 100 under sequences and the error went away. I don't really understand why, or if I solved it or just postponed more problems.

Was there a way to eliminate the "duplicate"?