phacility/phabricator · error · Exception
LDAP Exception: LDAP Error #
Error message
LDAP Exception: %s LDAP Error #%d: %s
What it means
Wrapper raised by raiseConnectionException(): an LDAP operation reported an error (errno/message from ldap_errno/ldap_err2str), and the raw LDAP failure details are formatted into a single exception message. It is the adapter's generic conduit for any underlying PHP LDAP extension error, with errno 49 handled separately as a credential error.
Solutions
- Read the embedded LDAP error number and message to identify the real cause
- Verify bind credentials and DN formats for the failing operation
- Check LDAP server logs corresponding to the error code
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/applications/auth/adapter/PhutilLDAPAuthAdapter.php:455 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/2f07c18c854a7d8c.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/auth/adapter/PhutilLDAPAuthAdapter.php:455
// This is `LDAP_INVALID_CREDENTIALS`.
if ($errno == 49) {
throw new PhutilAuthCredentialException();
}
if ($errno || $error) {
$full_message = pht(
"LDAP Exception: %s\nLDAP Error #%d: %s",
$message,
$errno,
$error);
} else {
$full_message = pht(
'LDAP Exception: %s',
$message);
}
throw new Exception($full_message);
}
private function bindLDAP($conn, $user, PhutilOpaqueEnvelope $pass) {
$profiler = PhutilServiceProfiler::getInstance();
$call_id = $profiler->beginServiceCall(
array(
'type' => 'ldap',
'call' => 'bind',
'user' => $user,
));
// NOTE: ldap_bind() dumps cleartext passwords into logs by default. Keep
// it quiet.
if (strlen($user)) {
$ok = @ldap_bind($conn, $user, $pass->openEnvelope());
} else {
$ok = @ldap_bind($conn);
}View on GitHub (pinned to 5720a38cfe)