Body: <p>I am having an issue when trying import contacts into civi. We have imported many contacts before but all of the suddden I am getting this error:</p>
  
  <pre><code>Database Error Code: Duplicate entry '0385611' for key 'UI_external_identifier', 1062
  Additional Details:
  Array
  (
      [callback] =&gt; Array
          (
              [0] =&gt; CRM_Core_Error
              [1] =&gt; handle
          )
  
      [code] =&gt; -5
      [message] =&gt; DB Error: already exists
      [mode] =&gt; 16
      [debug_info] =&gt; INSERT INTO civicrm_contact (contact_type , contact_sub_type , do_not_email , do_not_phone , do_not_mail , do_not_sms , do_not_trade , is_opt_out , external_identifier , preferred_communication_method , preferred_language , hash , middle_name , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' , 'Applicant' ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , '0385611' , '' , 'en_US' , 'd2194546a08ba5d0bfd62d173aa2f933' , 'E' ,  1 ,  1 ,  1 )  [nativecode=1062 ** Duplicate entry '0385611' for key 'UI_external_identifier']
      [type] =&gt; DB_Error
      [user_info] =&gt; INSERT INTO civicrm_contact (contact_type , contact_sub_type , do_not_email , do_not_phone , do_not_mail , do_not_sms , do_not_trade , is_opt_out , external_identifier , preferred_communication_method , preferred_language , hash , middle_name , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' , 'Applicant' ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , '0385611' , '' , 'en_US' , 'd2194546a08ba5d0bfd62d173aa2f933' , 'E' ,  1 ,  1 ,  1 )  [nativecode=1062 ** Duplicate entry '0385611' for key 'UI_external_identifier']
      [to_string] =&gt; [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_contact (contact_type , contact_sub_type , do_not_email , do_not_phone , do_not_mail , do_not_sms , do_not_trade , is_opt_out , external_identifier , preferred_communication_method , preferred_language , hash , middle_name , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' , 'Applicant' ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , '0385611' , '' , 'en_US' , 'd2194546a08ba5d0bfd62d173aa2f933' , 'E' ,  1 ,  1 ,  1 )  [nativecode=1062 ** Duplicate entry '0385611' for key 'UI_external_identifier']"]
  )
  </code></pre>
  
  <p>I have removed all but one contact from the import and still get the error. It seems as though it will not update a contact with the same external ID even though I have the rule setup to do just that. </p>
  
  <p>Any suggestions?</p>
  
  <p>Thank,</p>
  
  <p>CiviCRM 4.7.3 on Drupal 7</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-03T13:20:57.097Z
Comments.Text: Welcome to StackExchange! It would be helpful if you could edit your question to include your version of CiviCRM and the CMS you are using (e.g. Drupal, WordPress, Joomla).
Comments.UserDisplayName: William Mortada
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-03T14:10:38.760Z
Comments.Text: Sorry forgot to add that info: 
  
  The version is 4.7.3 and the cms is drupal 7. 
  
  It appears that the duplicate matching is not working as it returns no matches even though there are some in there.
Comments.UserDisplayName: David
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-03T17:06:33.177Z
Comments.Text: What is it that you are trying to do. Do you want to add another contact with the same external id? That is not possible because the external id must be unique. Or do you want to update a contact using the external id to find it?
Comments.UserDisplayName: Kainuk - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-03T18:49:13.643Z
Comments.Text: I am trying to update an existing contact with the same external id. This is how we have historically kept civicrm in sync with another company system.
Comments.UserDisplayName: David
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-03T21:03:58.340Z
Comments.Text: I upgreaded to the most recent release and I am still receiving the error. I am not sure what broke the ability to update contacts via import, we used it allot in the past.
Comments.UserDisplayName: David
Tags: <contacts><import><duplicate-contacts>
Title: Error importing contacts - for key 'UI_external_identifier'
ThreadText: # Error importing contacts - for key 'UI_external_identifier'
  
  (Asked by: username_0 on 2017-02-02)
  
  I am having an issue when trying import contacts into civi. We have imported many contacts before but all of the suddden I am getting this error:
  
  ```
  Database Error Code: Duplicate entry '0385611' for key 'UI_external_identifier', 1062
  Additional Details:
  Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => handle
          )
  
      [code] => -5
      [message] => DB Error: already exists
      [mode] => 16
      [debug_info] => INSERT INTO civicrm_contact (contact_type , contact_sub_type , do_not_email , do_not_phone , do_not_mail , do_not_sms , do_not_trade , is_opt_out , external_identifier , preferred_communication_method , preferred_language , hash , middle_name , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' , 'Applicant' ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , '0385611' , '' , 'en_US' , 'd2194546a08ba5d0bfd62d173aa2f933' , 'E' ,  1 ,  1 ,  1 )  [nativecode=1062 ** Duplicate entry '0385611' for key 'UI_external_identifier']
      [type] => DB_Error
      [user_info] => INSERT INTO civicrm_contact (contact_type , contact_sub_type , do_not_email , do_not_phone , do_not_mail , do_not_sms , do_not_trade , is_opt_out , external_identifier , preferred_communication_method , preferred_language , hash , middle_name , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' , 'Applicant' ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , '0385611' , '' , 'en_US' , 'd2194546a08ba5d0bfd62d173aa2f933' , 'E' ,  1 ,  1 ,  1 )  [nativecode=1062 ** Duplicate entry '0385611' for key 'UI_external_identifier']
      [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_contact (contact_type , contact_sub_type , do_not_email , do_not_phone , do_not_mail , do_not_sms , do_not_trade , is_opt_out , external_identifier , preferred_communication_method , preferred_language , hash , middle_name , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' , 'Applicant' ,  0 ,  0 ,  0 ,  0 ,  0 ,  0 , '0385611' , '' , 'en_US' , 'd2194546a08ba5d0bfd62d173aa2f933' , 'E' ,  1 ,  1 ,  1 )  [nativecode=1062 ** Duplicate entry '0385611' for key 'UI_external_identifier']"]
  )
  
  ```
  
  I have removed all but one contact from the import and still get the error. It seems as though it will not update a contact with the same external ID even though I have the rule setup to do just that.
  
  Any suggestions?
  
  Thank,
  
  CiviCRM 4.7.3 on Drupal 7
  
  **Tags:** contacts, import, duplicate-contacts
  
  > **Comments:**
  > **username_1**: Welcome to StackExchange! It would be helpful if you could edit your question to include your version of CiviCRM and the CMS you are using (e.g. Drupal, WordPress, Joomla).  
  > **username_0**: Sorry forgot to add that info:   The version is 4.7.3 and the cms is drupal 7.   It appears that the duplicate matching is not working as it returns no matches even though there are some in there.  
  > **username_2**: What is it that you are trying to do. Do you want to add another contact with the same external id? That is not possible because the external id must be unique. Or do you want to update a contact using the external id to find it?  
  > **username_0**: I am trying to update an existing contact with the same external id. This is how we have historically kept civicrm in sync with another company system.  
  > **username_0**: I upgreaded to the most recent release and I am still receiving the error. I am not sure what broke the ability to update contacts via import, we used it allot in the past.  
  
  ---
  
  ## 0 answers
  
  