0

When creating a new user account, as a visitor or unregistered user, I get the following message:

The website encountered an unexpected error. Please try again later.

and the account is not fully created.

The log (admin/reports/dblog) gives the following description of the error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, created, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 150752 [:db_insert_placeholder_1] => 1422513054 [:db_insert_placeholder_2] => a:6:{s:7:"contact";i:1;s:20:"l10n_client_disabled";b:0;s:17:"mimemail_textonly";i:0;s:34:"user_relationships_ui_auto_approve";a:0:{}s:34:"user_relationship_mailer_send_mail";b:1;s:40:"user_relationships_allow_private_message";s:12:"on all users";} ) in drupal_write_record() (line 7239 of /home3/zacteyc1/public_html/includes/common.inc).

The referer is: user/register

However, if I am the super user (user/1) I can create a complete new user account with no error.

I have disabled all the modules I could (including core ones) one by one to find the culprit but even with all modules disabled, the error persists.

I have also uploaded a fresh copy of the core files, but to no avail.

I have then uploaded, one by one, backups of my database going as far back as September 2014. It is with the September 14, 2014 (and prior) that the error disappears.

I need to fix the current database otherwise I will have lots of angry users who will have lost all the pictures they uploaded, all they have written in blogs, messages, etc. since September!

Does anyone know how to do this (like comparing a "good" database with a "bad" one to isolate the error?)

Any and all suggestions to fix the current database is greatly appreciated!

Thanks. :)

  • Duplicate entry '' for key 'name' should give you a clue. Do you have a module that alters the account creation process in any way? – 2pha Jan 31 '15 at 5:16
  • I searched and searched this "Duplicate entry" thing and could not find where in the database the problem was. In fact, it was misleading as I finally found the problem. See answer below. Thank you for your input though. – user14666 Jan 31 '15 at 18:49
  • Glad to see you got it sorted and +1 for coming back and posting the answer. – 2pha Feb 1 '15 at 2:50
1

The issue was created by rules.

I had read somewhere on two or three occasions that the Rules module could generate such error but I thought disabling the module would be enough to show if rules were involved or not. It didn't. Apparently, the rules are still active when the module is disabled (a diehard, at least in my case!)

I also had to disable the rules one by one until I found the culprit. It was a rule automatically making the new authenticated user a member of a welcome group. Somehow, the data in the rule had shifted and it was no longer the account but the site:logged-in-user that was made a member of the group.

The lesson here is about Rules and that the rules need to be disabled. Disabling the module alone is not enough. I hope this helps someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.