1

This is with CiviCRM 5.60.0 on Drupal 9.5.5.

On the Contact Summary page there is an action to "Create User Record"

enter image description here

When this is clicked it gives an error:

enter image description here

After this the system shows the following:

  • The original Contact has not had a Drupal User added.
  • There is a new Contact with the same email address as the original, but also using that email as the Contact's name.
  • The new Contact is linked to a new Drupal User record.

It looks to me like a de-duplication problem. Our Unsupervised De-dupe rule requires both the Contact's Name and Email address to match (or Name and Postcode to allow for legacy Contacts without a recorded email address). If I change this to Email only then there is no error, and the Drupal User record links correctly.

Thank you, Tony.

In case it is of use this is the backtrace logged against the error. (I can't see how to attach as a file.)

$backTrace = 

#0 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/Error.php(952): CRM_Core_Error::backtrace("backTrace", TRUE) 

#1 /home/lalg/www/d9dev1/vendor/pear/pear-core-minimal/src/PEAR.php(945): CRM_Core_Error::exceptionHandler(Object(DB_Error)) 

#2 /home/lalg/www/d9dev1/vendor/pear/db/DB.php(997): PEAR_Error->__construct("DB Error: already exists", -5, 16, (Array:2), "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_...") 

#3 /home/lalg/www/d9dev1/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-5, 16, (Array:2), "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_...") 

#4 /home/lalg/www/d9dev1/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR::_raiseError(Object(DB_mysqli), NULL, -5, 16, (Array:2), "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_...", "DB_Error", TRUE)
 
#5 /home/lalg/www/d9dev1/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7)) 

#6 /home/lalg/www/d9dev1/vendor/pear/db/DB/mysqli.php(943): DB_common->raiseError(-5, NULL, NULL, "INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_...", "1062 ** Duplicate entry '[email protected]' for key 'UI_uf_name_do...") 

#7 /home/lalg/www/d9dev1/vendor/pear/db/DB/mysqli.php(413): DB_mysqli->mysqliRaiseError()
 
#8 /home/lalg/www/d9dev1/vendor/pear/db/DB/common.php(1234): DB_mysqli->simpleQuery("INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_...") 

#9 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-packages/DB/DataObject.php(2696): DB_common->query("INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_...") 

#10 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-packages/DB/DataObject.php(1245): DB_DataObject->_query("INSERT INTO `civicrm_uf_match` (`domain_id` , `uf_id` , `uf_name` , `contact_...") 

#11 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/DAO.php(683): DB_DataObject->insert() 

#12 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/BAO/UFMatch.php(40): CRM_Core_DAO->save() 

#13 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/BAO/CMSUser.php(50): CRM_Core_BAO_UFMatch::create((Array:4))
 
#14 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Contact/Form/Task/Useradd.php(113): CRM_Core_BAO_CMSUser::create((Array:10), "email") 

#15 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/Form.php(578): CRM_Contact_Form_Task_Useradd->postProcess() 

#16 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/StateMachine.php(144): CRM_Core_Form->mainProcess() 

#17 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Next.php(43): CRM_Core_StateMachine->perform(Object(CRM_Contact_Form_Task_Useradd), "next", "Next") 

#18 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contact_Form_Task_Useradd), "next") 

#19 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Task_Useradd), "next") 

#20 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle("next") 

#21 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Contact/Page/View/Useradd.php(35): CRM_Core_Controller->run() 

#22 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(319): CRM_Contact_Page_View_Useradd->run((Array:4), NULL) 

#23 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem((Array:18)) 

#24 /home/lalg/www/d9dev1/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:4)) 

#25 /home/lalg/www/d9dev1/web/modules/contrib/civicrm/src/Civicrm.php(88): CRM_Core_Invoke::invoke((Array:4)) 

#26 /home/lalg/www/d9dev1/web/modules/contrib/civicrm/src/Controller/CivicrmController.php(80): Drupal\civicrm\Civicrm->invoke((Array:4)) 

#27 [internal function](): Drupal\civicrm\Controller\CivicrmController->main((Array:4), "")
 
#28 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array((Array:2), (Array:2)) 

#29 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 

#30 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 

#31 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext((Array:2), (Array:2)) 

#32 /home/lalg/www/d9dev1/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 

#33 /home/lalg/www/d9dev1/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) 

#34 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#35 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#36 /home/lalg/www/d9dev1/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#37 /home/lalg/www/d9dev1/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#38 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#39 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#40 /home/lalg/www/d9dev1/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#41 /home/lalg/www/d9dev1/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, TRUE) 

#42 /home/lalg/www/d9dev1/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) 

#43 {main}
6
  • ah. interesting. we hit this issue, briefly, on a site that also had the CMS User extension. but we couldn't replicate it on a site that did not have that extension. and we subsequently found that it was working again on the original site. i assumed it was something unique due to CMS User but now you have me wondering if it was some particular combination of civi and drupal versions
    – petednz - fuzion
    Commented Apr 21, 2023 at 21:53
  • i just retested on tht site and not seeing the duplicated contact with user problem. 5.58 and drupal latest 9. but i can't understand how it could be the civi version unless there was this problem pre-5.58, then 5.58 fixed it, then 5.60 or other re-introduced it
    – petednz - fuzion
    Commented Apr 21, 2023 at 22:03
  • I can reproduce it if I set the dedupe rule as they've described - e.g. first_name, last_name, email, postcode, all with weight 10, and threshold of 30.
    – Demerit
    Commented Apr 22, 2023 at 16:20
  • We actually have a rule of Name plus (Email or Postcode). First Name weight 20, Last name 20, Email 5, Postcode 5, threshold 45. Not sure that the Postcode bit is relevant, but no time to check today.
    – user6274
    Commented Apr 23, 2023 at 6:12
  • No, PostCode is irrelevant. The problem occurs with just the reserved rule of (First and Last) Name and Email.
    – user6274
    Commented Apr 24, 2023 at 9:28

1 Answer 1

0

This is fixed now in 5.63. See ticket mentioned in comments: https://lab.civicrm.org/dev/drupal/-/issues/186

Your Answer

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