Answers.Body: <p>Did you recently migrated from D7 to D9? If so please do the following below</p>
  <ol>
  <li>Log in as Admin into your website.</li>
  <li>Navigate to CiviCRM &gt;&gt; Contacts &gt;&gt; Find and Merge Duplicate Contacts.</li>
  <li>Check if the Unsupervised Individual rule is set to email only, if not create a new Unsupervised Individual rule with email only and make a not of old unsupervised rule.</li>
  <li>Take the site offline(maintenance mode ON).</li>
  <li>Log out from the website.</li>
  <li>Log in to mysql via phpmyadmin or terminal and run the truncate table command. <code>TRUNCATE TABLE civicrm_uf_match;</code></li>
  <li>Log in as Admin into your website.</li>
  <li>Navigate to CiviCRM &gt;&gt; Administer &gt;&gt; Users and Permissions &gt;&gt; Synchronize Users to Contacts</li>
  <li>Click 'Ok' button.</li>
  <li>Take the site online(maintenance mode OFF).</li>
  </ol>
  <p>HTH</p>
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-16T20:08:01.427Z
Answers.Text: Thank you for the detailed answer.  I am concerned and a bit hesitant to truncate the uf match table as I have a lot of users, some of whom share an email (i.e., significant others, business partners, etc) and I do not want to lose their accounts / mismatch records.
Answers.UserDisplayName: Greyson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-15T11:40:44.027Z
Answers.LastActivityDate: 2022-06-15T11:40:44.027Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>During any event registration while the user is <strong>not</strong> logged in (i.e., if they are a new user) produces the following error.  After doing a bunch of research, the consensus seemed to be that the issue was fixed in an earlier version of CiviCRM.  I upgraded Civi to the most recent version to no avail.  Here are the following steps I have taken:</p>
  <ol>
  <li>Cleared Cache</li>
  <li>Disabled every extension</li>
  <li>Disabled any custom module using civicrm</li>
  <li>Upgraded CiviCRM to the most recent version</li>
  <li>Restarted the entire server, upgraded the server (Probably unnecessary but figured I would since I was already there).</li>
  </ol>
  <p>It appears to work fine if the user is already logged in.</p>
  <p>CiviCRM: 5.50.1<br />
  Drupal: 9.3.16<br />
  Ubuntu: 20.04<br />
  PHP: 7.4.30<br />
  Server version: Apache/2.4.54 (Ubuntu)<br />
  MariaDB: 10.3.34</p>
  <pre><code>[error]  $Fatal Error Details = array:3 [   &quot;message&quot; =&gt; &quot;DB Error: already exists&quot;   &quot;code&quot; =&gt; null   &quot;exception&quot; =&gt; PEAR_Exception {#15678
      #cause: DB_Error {#15680
        +error_message_prefix: &quot;&quot;
        +mode: 16
        +level: 1024
        +code: -5
        +message: &quot;DB Error: already exists&quot;
        +userinfo: &quot;INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_id` ) VALUES ( 1 ,  1529 , 'awdawd@awdawd.com' ,  12102 )  [nativecode=1062 ** Duplicate entry 'awdawd@awdawd.com-1' for key 'UI_uf_name_domain_id']&quot;
        +backtrace: array:41 [
          0 =&gt; array:6 [
            &quot;file&quot; =&gt; &quot;/var/www/website.org/vendor/pear/db/DB.php&quot;
            &quot;line&quot; =&gt; 997
            &quot;function&quot; =&gt; &quot;__construct&quot;
            &quot;class&quot; =&gt; &quot;PEAR_Error&quot;
            &quot;type&quot; =&gt; &quot;-&gt;&quot;
            &quot;args&quot; =&gt; array:5 [
              0 =&gt; &quot;DB Error: already exists&quot;
              1 =&gt; -5
              2 =&gt; 16
              3 =&gt; array:2 [
                0 =&gt; &quot;CRM_Core_Error&quot;
                1 =&gt; &quot;exceptionHandler&quot;
              ]
              4 =&gt; &quot;INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_id` ) VALUES ( 1 ,  1529 , 'awdawd@awdawd.com' ,  12102 )  [nativecode=1062 ** Duplicate entry 'awdawd@awdawd.com-1' for key 'UI_uf_name_domain_id']&quot;
            ]
          ]
  </code></pre>
  <p>Any help would be greatly appreciated. Thank you!</p>
  <p>EDIT: Still an issue.</p>
  
Tags: <civievent>
Title: Event Registration DB Error: already exists | Duplicate entry [] for key 'UI_uf_name_domain_id'
ThreadText: # Event Registration DB Error: already exists | Duplicate entry [] for key 'UI_uf_name_domain_id'
  
  (Asked by: username_0 on 2022-06-14)
  
  During any event registration while the user is **not** logged in (i.e., if they are a new user) produces the following error. After doing a bunch of research, the consensus seemed to be that the issue was fixed in an earlier version of CiviCRM. I upgraded Civi to the most recent version to no avail. Here are the following steps I have taken:
  
  1. Cleared Cache
  2. Disabled every extension
  3. Disabled any custom module using civicrm
  4. Upgraded CiviCRM to the most recent version
  5. Restarted the entire server, upgraded the server (Probably unnecessary but figured I would since I was already there).
  
  It appears to work fine if the user is already logged in.
  
  CiviCRM: 5.50.1  
  Drupal: 9.3.16  
  Ubuntu: 20.04  
  PHP: 7.4.30  
  Server version: Apache/2.4.54 (Ubuntu)  
  MariaDB: 10.3.34
  
  ```
  [error]  $Fatal Error Details = array:3 [   "message" => "DB Error: already exists"   "code" => null   "exception" => PEAR_Exception {#15678
      #cause: DB_Error {#15680
        +error_message_prefix: ""
        +mode: 16
        +level: 1024
        +code: -5
        +message: "DB Error: already exists"
        +userinfo: "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_id` ) VALUES ( 1 ,  1529 , 'awdawd@awdawd.com' ,  12102 )  [nativecode=1062 ** Duplicate entry 'awdawd@awdawd.com-1' for key 'UI_uf_name_domain_id']"
        +backtrace: array:41 [
          0 => array:6 [
            "file" => "/var/www/website.org/vendor/pear/db/DB.php"
            "line" => 997
            "function" => "__construct"
            "class" => "PEAR_Error"
            "type" => "->"
            "args" => array:5 [
              0 => "DB Error: already exists"
              1 => -5
              2 => 16
              3 => array:2 [
                0 => "CRM_Core_Error"
                1 => "exceptionHandler"
              ]
              4 => "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_id` ) VALUES ( 1 ,  1529 , 'awdawd@awdawd.com' ,  12102 )  [nativecode=1062 ** Duplicate entry 'awdawd@awdawd.com-1' for key 'UI_uf_name_domain_id']"
            ]
          ]
  
  ```
  
  Any help would be greatly appreciated. Thank you!
  
  EDIT: Still an issue.
  
  **Tags:** civievent
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-06-15. Score: 1
  
  Did you recently migrated from D7 to D9? If so please do the following below
  
  1. Log in as Admin into your website.
  2. Navigate to CiviCRM >> Contacts >> Find and Merge Duplicate Contacts.
  3. Check if the Unsupervised Individual rule is set to email only, if not create a new Unsupervised Individual rule with email only and make a not of old unsupervised rule.
  4. Take the site offline(maintenance mode ON).
  5. Log out from the website.
  6. Log in to mysql via phpmyadmin or terminal and run the truncate table command. `TRUNCATE TABLE civicrm_uf_match;`
  7. Log in as Admin into your website.
  8. Navigate to CiviCRM >> Administer >> Users and Permissions >> Synchronize Users to Contacts
  9. Click 'Ok' button.
  10. Take the site online(maintenance mode OFF).
  
  HTH
  
  username_1
  
  > **Comments:**
  > **username_0**: Thank you for the detailed answer.  I am concerned and a bit hesitant to truncate the uf match table as I have a lot of users, some of whom share an email (i.e., significant others, business partners, etc) and I do not want to lose their accounts / mismatch records.  
  
  ---
  
  