Closed (fixed)
Project:
Documentation
Component:
Installation
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
17 May 2006 at 13:42 UTC
Updated:
3 Jul 2006 at 14:00 UTC
I think it would be a *fab* idea to have a page on this in the trouble shooting faq.
I will write up a page; if you all know of some forum topics that reference this problem (same problem, so many different errors!), please post them with this issue.
Anisa.
Comments
Comment #1
rivena commentedHere is my rough draft! I removed the formatting so you can see it in your email.
In addition, I think new links/info on the following would be good:
HOWTO: Access your database
HOWTO: Edit your database
Other forum examples of errors.
Explanation for why this happens.
-------------------------------
PLAIN TEXT VERSION
This page is for errors similar to the one below:
user error: Duplicate entry '24' for key 1
query: INSERT INTO node (status, moderate, promote, sticky, title, body, format, uid, created, type, teaser, changed, nid) VALUES('1', '0', '1', '0', 'test', 'this is a test', '1', '1', '1149692821', 'story', 'this is a test', '1149692832', '24') in .../includes/database.mysql.inc on line 66.
warning: Cannot modify header information - headers already sent by (output started at .../includes/common.inc:384) in .../includes/common.inc on line 192.
The problem (short form): At some point, the sequence table in your Drupal database was not updated.
The solution
1. Access your database. Check the affected table. In this case, the error tells us that it is the nodetable (query: INSERT INTO node). This also happens with other tables, modify these instructions accordingly.
2. This is the node table, so the problem is the node id (nid). Each node has a unique id. Look at your table, and find the highest node id (nid). If you have many nodes, it may help to sort your table by nid to find the highest one.
3. Go to your sequences table. Change the node id in the sequences table to a number higher than the id you found in step 2.
Voila!
----------------------------------
I would call this 'Duplicate entry error' and put this in the Troubleshooting FAQ. Please let me know what you think.
Anisa.
Comment #2
rivena commentedIf this is OK as is, I will submit it to the handbook as a page.... ?
Anisa.
Comment #3
PAAHCweb commentedBless you for posting this! Couldn't find anything helpful through Drupal search. The host server went down while I was editing my site. Duplicate entry errors appear when I try to access settings menu.
I'm having trouble applying this to my situation, and it seems unclear what you mean by "a number higher than the id you find there." Does that mean (1) higher?
To illustrate, my error is related to the system table. The only integer values there are "status" and "bootstrap". This is an abbreviated entry for "status":
Should I use the value for "rows" to update the sequences table? Presently the value for "id" in the sequences table is 10. So would that 106? 96? or something in another ballpark?
Thanks,
D. Lynn
Comment #4
rivena commentedSorry to disappoint you, but I think that your problem may be different.
The only things that must have unique values in a table are the indexed fields. For your systems table, that's the file name field. What is your error exactly? Do you have two modules with the same name?
With my solution here, the problem is with, for example, node ids (nid). Each node must have a unique id. Each time a node is created, the node gets an ID that is one higher than the old one, and the value in the sequences table is increased by 1. Instead of asking the node table what the next id is, Drupal looks to the sequences table. So if the sequence table isn't updated, Drupal comes up with an old ID, and creates the error.
The error is because you are trying to create something that has the same ID (or Name in this case) as something that already exists.
Anisa.
Comment #5
PAAHCweb commentedOK, I understand better, thank you Anisa.
There was an avalanche(?) of "header already sent", 13 duplicate entry errors arising from the system table (each referencing a different module), then "mdir(temp) permission denied". Since these errors all happened at the same minute, I assumed they were connected, but maybe not. The duplicate errors may have happened because for a while after the reboot, there were two copies of my site on the server. Only the permission denied error persists when I try to access settings.
I'm not disappointed at all! Your explanation was very helpful because the dang MySQL documentation is so hard to understand. It's an excellent idea to "translate" some common SQL errors, with simple fixes.
Again thanks,
D. Lynn
Comment #6
rivena commentedI have submitted the page to the handbook, it's currently in the moderation que.
Anisa.
Comment #7
(not verified) commented