{"record":{"id":"acb29abe4aa39425","repo":"phacility/phabricator","slug":"ldap-record-query-returned-more-than-one-result-t","errorCode":null,"errorMessage":"LDAP record query returned more than one result. The query must uniquely identify a record.","messagePattern":"LDAP record query returned more than one result\\. The query must uniquely identify a record\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/auth/adapter/PhutilLDAPAuthAdapter.php","lineNumber":384,"sourceCode":"\n      $this->ldapConnection = $conn;\n    }\n\n    return $this->ldapConnection;\n  }\n\n\n  private function searchLDAPForRecord($dn) {\n    $conn = $this->establishConnection();\n\n    $results = $this->searchLDAP('%Q', $dn);\n\n    if (!$results) {\n      return null;\n    }\n\n    if (count($results) > 1) {\n      throw new Exception(\n        pht(\n          'LDAP record query returned more than one result. The query must '.\n          'uniquely identify a record.'));\n    }\n\n    return head($results);\n  }\n\n  public function searchLDAP($pattern /* ... */) {\n    $args = func_get_args();\n    $query = call_user_func_array('ldap_sprintf', $args);\n\n    $conn = $this->establishConnection();\n\n    $profiler = PhutilServiceProfiler::getInstance();\n    $call_id = $profiler->beginServiceCall(\n      array(\n        'type'  => 'ldap',","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/adapter/PhutilLDAPAuthAdapter.php#L366-L402","documentation":"Uniqueness guard in searchLDAPForRecord(): the LDAP search for a single distinguished name matched more than one entry. Because the code must return exactly one record, an ambiguous match is treated as a configuration error (typically a search base that is too broad).","triggerScenarios":"Thrown at src/applications/auth/adapter/PhutilLDAPAuthAdapter.php:384 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Narrow the LDAP search base DN so queries match at most one record","Verify the username search attribute is unique in the directory","Fix duplicated directory entries causing the ambiguity"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","contentChangedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}