Error: user warning: Duplicate entry “n” for key 1…

After doing a user import via csv into a new Drupal site, some new users could no longer register. When I attempted to create the users manually, I got this error:

user error: Duplicate entry ”348′ for key 1…

I found the answer in the Drupal troubleshooting FAQ:

  • Access your database. Check the affected table. In this case, the error tells us that it is the node table (query: INSERT INTO node). This also happens with other tables, modify these instructions accordingly.
  • 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.
  • 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.

There is also a detailed explanation of what causes this error (See “The problem (long form):”)