I receive the error below during the upgrade process. I restored to previous backup and tried again and received the same. Any ideas what exactly is it indicating is duplicate? Thanks so much!

[Error: Migrate Settings to 4.7.alpha1] Error Field Error Value Type DB_Error Code -5 Message DB Error: already exists Mode 16 UserInfo ALTER TABLE civicrm_setting ADD UNIQUE INDEX index_domain_contact_name (domain_id, contact_id, name) [nativecode=1062 ** Duplicate entry '1-571-activity_tab_filter' for key 'index_domain_contact_name'] DebugInfo ALTER TABLE civicrm_setting ADD UNIQUE INDEX index_domain_contact_name (domain_id, contact_id, name) [nativecode=1062 ** Duplicate entry '1-571-activity_tab_filter' for key 'index_domain_contact_name']

  • I'm running the db tools package to see if that will help me identify the source of this problem. Will update if I receive an answer from that. Commented Feb 2, 2016 at 7:35

4 Answers 4


It seems that you have the same setting that is set twice on your database, and the upgrade to 4.7 enforce it won't happen.

You will need to list your settings as stored in the database, you should see more than one activity_tab_filter for the contact_id 571.

Delete the duplicate(s) and keep only one and then run the upgrade again and you should be fine


  • I experienced a similar problem to Iantha. Unfortunately, the upgrade won't run again with the error, "Database check failed - the database looks to have been partially upgraded. You may want to reload the database with the backup and try the upgrade process again." I tried restoring a backup of the database, but that hasn't worked either.
    – Esther
    Commented Feb 2, 2016 at 10:53
  • I got my database restored to a backup, deleted the duplicates (or so I thought) and still got the same error. In deleting the duplicates, I noticed that they were all of my own name - well over 5,000 entries. The duplicate entries are no doubt elated to this problem I was having - civicrm.stackexchange.com/questions/6883/… . I'm now going to go back to 4.6, hopefully that will still work!
    – Esther
    Commented Feb 2, 2016 at 13:54
  • Thanks Penny and Xavier. I did get this fixed. I am not quite sure about the error, though. It was my own contact entry causing the problem. No problem to delete myself. But, there is no duplicate for me. I went through and cleaned up test activities that were in my record, but that did not solve the problem. In the end, I went ahead and permanently deleted myself and everything upgraded fine. But, I'm feeling a little strange about what was the real source of the error in the record. Commented Feb 3, 2016 at 0:42
  • @Penny It sounds like you restored a backup of the database without dropping and recreating the MySQL database. CiviCRM 4.7 adds new tables to the database; restoring a backup won't overwrite tables that weren't in the backup. So you must drop/recreate the database before restoring in order to fix a "partially upgraded" error. Commented May 3, 2016 at 13:12
  • @IanthaScheiwe Yup - that's exactly what I ended up doing to resolve the problem.
    – Esther
    Commented May 7, 2016 at 6:59

This would appear to be an issue that should be cleaned up prior to the upgrade. I have logged this issue in the JIRA issue queue here https://issues.civicrm.org/jira/browse/CRM-18485 and I have a proposed solution of essentially purging the database of the activity_tab_filter settings before upgrade. My proposed solution is here https://github.com/civicrm/civicrm-core/pull/8273

  • This solution worked best for me, to delete activity_tab_filter entries from civicrm_setting.
    – choster
    Commented Jun 3, 2016 at 14:59

Initially deleted what appeared to be duplicate activity entries from user #571, but that did not fix the problem. Restored to the backup version and then this problem was finally resolved by deleting user 571 (my own entry) from the DB.


Similar problem here. How do we fix this problem? I don't understand how to do this: "You will need to list your settings as stored in the database..."

enter image description here

  • That screenshot is exactly what happened to me. I haven't tried again since now I'm getting another error civicrm.stackexchange.com/questions/9456/…
    – Esther
    Commented Feb 7, 2016 at 13:41
  • The only way I could resolve the error was to remove the offending contact entry. Not the ideal solution and only workable since it was a single entry with little supporting data attached. I could not find any duplicate entry or duplicate content within the entry that would have cause the offense. Commented Feb 16, 2016 at 7:07
  • It looks like the contact that is causing you trouble is CID33890. Commented Feb 16, 2016 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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