phacility/phabricator · error · Exception
LDAP: Failed to retrieve record for user
Error message
LDAP: Failed to retrieve record for user "%s" when searching with both user and anonymous credentials.
What it means
Final failure guard in the LDAP adapter: the user's DN could not be found even after rebinding with anonymous credentials and retrying the search. Both the credentialed and anonymous search paths returned no record, so user data cannot be loaded.
Solutions
- Verify the LDAP search base DN and search attribute match where users actually live
- Test the same search with ldapsearch to confirm the user is findable
- Check the anonymous bind credentials configured in Phabricator
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/applications/auth/adapter/PhutilLDAPAuthAdapter.php:282 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/5ae7c4c3092a20e4.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/auth/adapter/PhutilLDAPAuthAdapter.php:282
// again below. Doing this automatically means things work correctly more
// often without requiring additional configuration.
if (!$this->shouldBindWithoutIdentity()) {
// No anonymous credentials, so we just fail here.
throw new Exception(
pht(
'LDAP: Failed to retrieve record for user "%s" when searching. '.
'Credentialed users may not be able to search your LDAP server. '.
'Try configuring anonymous credentials or fully anonymous binds.',
$login_user));
} else {
// Rebind as anonymous and try the search again.
$user = $this->anonymousUsername;
$pass = $this->anonymousPassword;
$this->bindLDAP($conn, $user, $pass);
$result = $this->searchLDAPForRecord($search_query);
if (!$result) {
throw new Exception(
pht(
'LDAP: Failed to retrieve record for user "%s" when searching '.
'with both user and anonymous credentials.',
$login_user));
}
}
}
return $result;
}
private function establishConnection() {
if (!$this->ldapConnection) {
$host = $this->hostname;
$port = $this->port;
$profiler = PhutilServiceProfiler::getInstance();
$call_id = $profiler->beginServiceCall(View on GitHub (pinned to 5720a38cfe)