Answers.Body: <p>From the error it looks like drupal username "test@example.com" already exists, when contribution form is submitted, it is trying to add a new drupal user and civicrm contact which is failing because of a duplicate.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-30T17:41:26.893Z
Answers.Text: I know but it didn't. It does it every time. Meaning it's creating it and then creating it again in the same transaction. Also, I don't believe it's Drupal, it's ufc domain match.
Answers.UserDisplayName: Christia
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-30T20:13:57.250Z
Answers.Text: Do you have any drupal rule setup or any other customization which would be creating drupal user other than civi default behavior?
Answers.UserDisplayName: Hassan Farooq
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-30T17:40:08.270Z
Answers.LastActivityDate: 2019-01-30T17:40:08.270Z
Answers.UserDisplayName: Hassan Farooq
Body: <p>On one of our contribution forms for users to sign up and pay for a membership, we are getting a DB Error. Here is a screenshot of the contribution form so you can see where they are urged to create an account.
  <a href="https://i.sstatic.net/c87Vc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c87Vc.png" alt="enter image description here"></a></p>
  
  <p>Here is the error log message, where <code>test@example.com</code> is my test user, who submitted a transaction and created an account on the form. I used a fresh email address, just replaced it here:</p>
  
  <pre><code>[info] $Fatal Error 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_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  209115 , 'test@example.com' ,  140637 )  [nativecode=1062 ** Duplicate entry 'test@example.com-1' for key 'UI_uf_name_domain_id']
      [type] =&gt; DB_Error
      [user_info] =&gt; INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  209115 , 'test@example.com' ,  140637 )  [nativecode=1062 ** Duplicate entry 'test@example.com-1' for key 'UI_uf_name_domain_id']
      [to_string] =&gt; [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  209115 , 'test@example.com' ,  140637 )  [nativecode=1062 ** Duplicate entry 'test@example.com-1' for key 'UI_uf_name_domain_id']"]
  )
  </code></pre>
  
  <p>The transaction came into the CRM as Pending (Incomplete Transaction). I also processed a test donation, a contribution form that doesn't require the user to create an account, and I did not get an error, however, the transaction still came in as Pending (Incomplete Transaction).</p>
  
  <p>I have recently upgraded to CiviCRM 5.9.0 and Drupal 7.63.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-29T19:38:19.480Z
Comments.Text: may be worth seeing if you can duplicate on dmaster.demo.civicrm.org
Comments.UserDisplayName: petednz - fuzion
Tags: <drupal><civicontribute>
Title: DB Error on contribution form unless signed in
ThreadText: # DB Error on contribution form unless signed in
  
  (Asked by: username_0 on 2019-01-29)
  
  On one of our contribution forms for users to sign up and pay for a membership, we are getting a DB Error. Here is a screenshot of the contribution form so you can see where they are urged to create an account.
  [![enter image description here](https://i.sstatic.net/c87Vc.png)](https://i.sstatic.net/c87Vc.png)
  
  Here is the error log message, where `test@example.com` is my test user, who submitted a transaction and created an account on the form. I used a fresh email address, just replaced it here:
  
  ```
  [info] $Fatal Error Details = Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => handle
          )
  
      [code] => -5
      [message] => DB Error: already exists
      [mode] => 16
      [debug_info] => INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  209115 , 'test@example.com' ,  140637 )  [nativecode=1062 ** Duplicate entry 'test@example.com-1' for key 'UI_uf_name_domain_id']
      [type] => DB_Error
      [user_info] => INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  209115 , 'test@example.com' ,  140637 )  [nativecode=1062 ** Duplicate entry 'test@example.com-1' for key 'UI_uf_name_domain_id']
      [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 ,  209115 , 'test@example.com' ,  140637 )  [nativecode=1062 ** Duplicate entry 'test@example.com-1' for key 'UI_uf_name_domain_id']"]
  )
  
  ```
  
  The transaction came into the CRM as Pending (Incomplete Transaction). I also processed a test donation, a contribution form that doesn't require the user to create an account, and I did not get an error, however, the transaction still came in as Pending (Incomplete Transaction).
  
  I have recently upgraded to CiviCRM 5.9.0 and Drupal 7.63.
  
  **Tags:** drupal, civicontribute
  
  > **Comments:**
  > **username_1**: may be worth seeing if you can duplicate on dmaster.demo.civicrm.org  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-01-30. Score: 0
  
  From the error it looks like drupal username "test@example.com" already exists, when contribution form is submitted, it is trying to add a new drupal user and civicrm contact which is failing because of a duplicate.
  
  > **Comments:**
  > **username_0**: I know but it didn't. It does it every time. Meaning it's creating it and then creating it again in the same transaction. Also, I don't believe it's Drupal, it's ufc domain match.  
  > **username_2**: Do you have any drupal rule setup or any other customization which would be creating drupal user other than civi default behavior?  
  
  ---
  
  