§ 06 · LDAP / ACTIVE DIRECTORY · TROUBLESHOOTING

Troubleshooting

Start with the admin test. It names the step that failed, the code, and the server it was talking to.

Where to look first

  1. The test buttons on Organization settings → LDAP. They show every step (Find server → Connect → TLS / certificate → Service account bind → Directory search → User password check → Read email and name) with ✓ or ✗, an error code and a plain message. This is the most detailed view there is.
  2. The core container log. Failed logins write ldap: sign-in failed with the code, host and port. Settings problems write ldap: could not load LDAP configuration or ldap: stored config could not be decrypted.
  3. The database, read-only, with the queries at the end of this page.

The login page shows a short, deliberately vague message. To see the real reason for one person, run Test user credential with their username (and let them type the password). The step log has the full code.

Every error code

All codes come from apps/web/modules/auth/ldap/lib/errors.ts. “Step” is where the test log marks the failure.

Settings and switches

CodeStepMeaningFix
LDAP_CONFIG_INCOMPLETE—A required value is missing, or the save was refused before testing. Messages include “Enter a test username and password…”, “Re-enter the bind password when changing the server, security or bind user.”, “A bind password is required.”, “Stored settings could not be decrypted; re-enter the bind password and save.” and “Settings changed while testing (another admin saved); review and save again.”Do what the message says. For the decrypt message: type the bind password again and save.
LDAP_DISABLED—LDAP is off in the settings, or LDAP_AUTH_DISABLED=1 is set.Turn it on, or remove the env variable and restart.

Finding and reaching the server

CodeStepMeaningFix
LDAP_SRV_NOT_FOUNDFind serverStandard mode found no DC through DNS (_ldap._tcp.<domain>), or every answer pointed outside the domain.Check the domain name. Usually: switch to Direct mode with the DC’s name or IP.
LDAP_DNS_NOT_FOUNDConnectThe server name does not resolve from the HiveCFM server.Use a name the HiveCFM host can resolve, or the IP (then see the hostname mismatch row).
LDAP_CONNECT_REFUSEDConnectConnection refused or host unreachable.Check host and port (636 LDAPS / 389 StartTLS or None) and the firewall from the HiveCFM host to the DC.
LDAP_CONNECT_TIMEOUTConnectNo answer within 5 seconds.Usually a firewall silently dropping traffic. Check the network path from the HiveCFM host.

TLS and certificates

CodeStepMeaningFix
LDAP_TLS_UNTRUSTED_CERTTLSThe DC’s certificate is signed by a CA HiveCFM does not trust (self-signed, or an internal CA).Paste the customer’s root CA (and any intermediate) as PEM into CA certificate.
LDAP_TLS_CERT_EXPIREDTLSThe DC’s certificate has expired.The customer renews the DC certificate.
LDAP_TLS_HOSTNAME_MISMATCHTLSThe name or IP you connect to is not in the certificate.Use the DC’s DNS name as the server (not an IP), or get a certificate that lists the name/IP you use.
LDAP_TLS_HANDSHAKE_FAILEDTLSTLS could not start. Almost always the security mode and the port do not match.LDAPS = 636. StartTLS and None = 389.
LDAP_STRONGER_AUTH_REQUIREDanyThe DC requires a secure connection (LDAP signing), usually because Security is None.Switch to LDAPS or StartTLS.
CodeStepMeaningFix
LDAP_BIND_SERVICE_INVALIDService account bindThe DC rejected the bind user or its password.Check Bind user (UPN like svc-hivecfm@bank.example, or the full DN) and Bind password. Has the password expired or been changed?
LDAP_BASE_DN_NOT_FOUNDDirectory searchThe Base DN does not exist on this DC.For bank.example it is DC=bank,DC=example. Check spelling and the domain.
LDAP_SEARCH_ACCESS_DENIEDDirectory searchThe service account may not read the Base DN.The customer grants it read access.
LDAP_REFERRALDirectory searchThe DC answered “ask another server”: the Base DN belongs to another domain.Narrow the Base DN to this domain, or point at a Global Catalog (port 3268, or 3269 with TLS).
LDAP_FILTER_INVALIDDirectory searchThe user filter is not valid LDAP syntax.It must be wrapped in parentheses and contain {username}. Go back to the default.
LDAP_OPERATION_TIMEOUTanyThe DC did not finish within 10 seconds.Narrow the Base DN, or check the DC’s load.

The person

CodeStepMeaningFix
LDAP_USER_NOT_FOUNDDirectory searchNo entry matches the username with this filter and Base DN.Is the person under the Base DN? Typo? A local admin typing their email into the company form also ends here: use Administrator sign-in.
LDAP_USER_MULTIPLEDirectory searchTwo or more entries match. HiveCFM never guesses.Make the user filter more specific.
LDAP_USER_INVALID_CREDENTIALSUser password checkFound, but the password is wrong.The person retypes; check Caps Lock and keyboard layout.
LDAP_EMPTY_PASSWORDUser password checkEmpty password, refused before any bind.Type a password.
LDAP_ACCOUNT_DISABLEDUser password checkAD data 533: the account is disabled.AD team enables it.
LDAP_ACCOUNT_LOCKEDUser password checkAD data 775: locked out after too many bad passwords.Wait for the lockout to end, or AD team unlocks it. The login page shows “Invalid username or password.” for this on purpose.
LDAP_ACCOUNT_EXPIREDUser password checkAD data 701: the account’s end date has passed.AD team extends it.
LDAP_PASSWORD_EXPIREDUser password checkAD data 532: the password expired.The person changes it in Windows.
LDAP_PASSWORD_MUST_CHANGEUser password checkAD data 773: “must change password at nextNext.jsReact framework used by HiveCFM Core. Handles routing, server rendering, and API routes in one bundle. logon” is set.The person signs in to Windows once and changes it.
LDAP_LOGON_RESTRICTEDUser password checkAD data 530 / 531: not allowed at this time, or from this workstation.AD team adjusts the logon hours or workstation list.
LDAP_NO_EMAIL_ATTRIBUTERead email and nameNo valid email in mail (or the configured attribute), and the UPN is not email-shaped.AD team fills mail, or change Email attribute.
LDAP_EMAIL_CONFLICTafter sign-inA non-LDAP HiveCFM account already uses this email, or an LDAP account bound to a different directory person does.See the symptom table.
LDAP_USER_INACTIVEafter sign-inThe person’s HiveCFM account is deactivated.Reactivate it in HiveCFM, if intended.
LDAP_UNKNOWNanyUnexpected error, including “the directory returned no objectGUID or entryUUID”.Read the step detail and the core log.

AD sub-codes

When AD refuses a bind, its message contains data <code>, for example 80090308: LdapErr: DSID-…, data 52e, v4563. HiveCFM reads that code:

AD sub-codeMeaning in ADHiveCFM codeLogin page says
525user not foundLDAP_USER_INVALID_CREDENTIALSInvalid username or password.
52ewrong passwordLDAP_USER_INVALID_CREDENTIALSInvalid username or password.
530logon not permitted at this timeLDAP_LOGON_RESTRICTED…can’t sign in (disabled, locked or expired)…
531logon not permitted from this workstationLDAP_LOGON_RESTRICTED…can’t sign in (disabled, locked or expired)…
532password expiredLDAP_PASSWORD_EXPIREDYour password has expired or must be changed…
533account disabledLDAP_ACCOUNT_DISABLED…can’t sign in (disabled, locked or expired)…
701account expiredLDAP_ACCOUNT_EXPIRED…can’t sign in (disabled, locked or expired)…
773must change passwordLDAP_PASSWORD_MUST_CHANGEYour password has expired or must be changed…
775account locked outLDAP_ACCOUNT_LOCKEDInvalid username or password.
other / none—LDAP_USER_INVALID_CREDENTIALSInvalid username or password.

During the service-account bind, any credential error is reported as LDAP_BIND_SERVICE_INVALID; the sub-code is still visible in the step detail.

Symptom → cause

SymptomLikely causeWhat to do
Save stays greyThe checklist beside it has a ✗. With the switch on, both tests must pass for exactly the current values.Read the line under the checklist. Changed a field after testing? Test again. Cleared the test password? Retype it.
Save says “Not saved — connection test failed” or “…the test user could not sign in”The server’s own re-test failed (the browser test passed earlier, but something changed, or the rate limit was hit).Read the step log under the buttons and fix that step.
”Maximum number of requests reached. Please try again later.” on the test buttons20 tests per 15 minutes per admin.Wait a few minutes.
After Save I’m stuck on the company login formYou are a local admin; the directory does not know your email.Click Administrator sign-in under the form and use your local password.
Administrator sign-in says “Invalid credentials” with the right passwordYou are not an owner of any organization, or your account is an LDAP account (LDAP users never use local passwords).Sign in with a local account that is an owner of some organization. If nobody can: use the kill switch.
Administrator sign-in shows no formEMAIL_AUTH_DISABLED=1 is set on the container.Remove it. LDAP sites need email auth for break-glass.
A person signs in and sees “No workspace found”Normal for a first sign-in when nobody added them in advance: no access yet.Add them under Members & Teams → Directory users waiting for access. Next time, add people before they sign in with Add from directory.
The person is not in the waiting listThey already belong to some organization, their HiveCFM account is inactive, they never signed in successfully, or more than 50 are waiting.Search by name or email. Check with the SQL below.
I can’t see the waiting list at allLDAP is off, the kill switch is set, you are not an owner or manager of this organization, or you are a manager without access control.See who sees it.
”An account with this email already exists” (LDAP_EMAIL_CONFLICT)A local or SSO account with that email exists, often created by “Add member” before the first LDAP sign-in, or by an invite that was accepted through Create account (local sign-up). Or the directory account was re-created with a new objectGUID.Decide which account is right. If the old one is unused, remove it (or change its email) so the directory sign-in can create a fresh LDAP user. HiveCFM will not merge them for you.
TLS errors right after go-live, but the test passed weeks agoThe DC certificate was renewed by a different CA, or expired.Paste the new CA, test, save. See Operations.
Everyone sees “Directory sign-in is temporarily unavailable”The DC is unreachable, the service account password changed, or ENCRYPTION_KEY changed.Run Test connection (via Administrator sign-in).
A person was disabled in AD but is still workingTheir session was open before the change. AD is checked at sign-in, not during a session.Deactivate them in HiveCFM, or wait for the session to end.
LDAP_SRV_NOT_FOUND in a containerThe container’s DNS does not know the AD domain.Use Direct mode.
Arabic or accented names look differentNames are cleaned to letters, digits, spaces, ' and -. Brackets and commas are removed.Expected. Smith, Jane (IT) becomes Smith Jane IT.

Add from directory

Problems with the Add from directory button and dialog on Members & Teams. The full feature is described in Add from directory.

SymptomLikely causeWhat to do
No “Add from directory” buttonYou are not an owner of this organization (managers do not get it), LDAP sign-in is off, the LDAP_AUTH_DISABLED=1 kill switch is set, or user management is turned off in the UI.Ask an owner. Check that LDAP is on in Organization settings → LDAP. Managers can still add people from the waiting card after their first sign-in.
Search shows nothing until I type moreThe search needs at least 3 characters.Type more of the name, email or username.
”Showing the first 10 matches. Type more to narrow it down.”More than 10 people match. Only the first 10 are shown.Type more, for example the full username or email.
Someone I know is in AD is not foundThe search only returns people who match the user filter under the Base DN, the same rule as sign-in. If they cannot sign in, they are not listed.Check the person with Test user credential. If the filter is limited to an AD group, they must be in it.
The search shows a directory error (cannot reach server, certificate, service account…)Same causes as the LDAP test buttons, and the same curated messages.Run Test connection on Organization settings → LDAP and fix the failing step (see Every error code).
”Maximum number of requests reached. Please try again later.” while searching or adding60 searches and adds together per 5 minutes per owner (one shared limit for both).Wait a few minutes. Typing pauses before it searches, so normal use stays far below the limit.
Row says “Already a member” and cannot be pickedThe person already belongs to this organization.Nothing to do. Change their role or teams in the members list.
Row says “Email belongs to another account”A local or single sign-on account (or an LDAP account bound to a different directory person) already uses this email. Their directory sign-in would fail with LDAP_EMAIL_CONFLICT, so HiveCFM will not add them.Same fix as LDAP_EMAIL_CONFLICT in the table above: decide which account is right and remove or rename the other. HiveCFM never merges them.
Row says “No email in directory”The directory entry has no valid mail (or the configured email attribute) and its UPN is not email-shaped either. Sign-in would fail with LDAP_NO_EMAIL_ATTRIBUTE.The customer’s AD team fills in mail.
Row says “Deactivated”The person’s HiveCFM account exists but is deactivated.Reactivate it in HiveCFM first, if that is intended.
Add refused: “Team “X members (read)” already exists with different workspace access…”Someone edited that workspace team. HiveCFM never changes an existing team.Add the person without that workspace, then put them in the right team on the Teams page.
Add refused for license or seat reasonsSame license and seat rules as an invite.Free a seat or renew the license. Nothing was created.
Add failed, and now the person is in Directory users waiting for access with “Not signed in yet”Rare: their HiveCFM user was created, then granting the membership failed (for example a database error). The user row is kept and audited.Add them from the waiting card, or search for them again in Add from directory.
Person added, but the members list still says “Waiting for first sign-in”They have not signed in with LDAP yet.Expected. The badge turns into Active after their first sign-in.

SQL: inspect directory users

Run these read-only queries on the HiveCFM core database. Table and column names are quoted because PrismaPrismaThe TypeScript ORM HiveCFM uses to talk to Postgres. The schema lives at packages/database/schema.prisma. created them in mixed case.

All LDAP users and where they have access (WAITING = signed in, not added yet):

SELECT u.name,
       u.email,
       u.created_at       AS created,      -- first sign-in, or when an owner added them from the directory
       u."lastLoginAt"    AS last_sign_in, -- NULL = never signed in
       u."isActive"       AS active,
       COALESCE(string_agg(o.name || ' (' || m.role || ')', ', '), 'WAITING') AS access
FROM "User" u
LEFT JOIN "Membership" m   ON m."userId" = u.id
LEFT JOIN "Organization" o ON o.id = m."organizationId"
WHERE u."identityProvider" = 'ldap'
GROUP BY u.id
ORDER BY u.created_at DESC;

Only the people waiting (the same rule as the card: LDAP, active, no membership anywhere):

SELECT u.name, u.email, u."lastLoginAt" AS last_sign_in
FROM "User" u
WHERE u."identityProvider" = 'ldap'
  AND u."isActive" = true
  AND NOT EXISTS (SELECT 1 FROM "Membership" m WHERE m."userId" = u.id)
ORDER BY u.created_at DESC;

Who owns an email (for LDAP_EMAIL_CONFLICT):

SELECT id, email, "identityProvider", "identityProviderAccountId", "isActive", created_at
FROM "User"
WHERE lower(email) = lower('jane.smith@bank.example');

The LDAP configuration, without the password:

SELECT enabled, mode, domain, host, port, security, base_dn, bind_dn,
       user_filter, email_attribute, name_attribute,
       (ca_certificate <> '')  AS has_ca_certificate,
       tls_reject_unauthorized AS verify_certificate,
       sessions_revoked_at, updated_at, updated_by
FROM instance_ldap_config;
⚠️

Never SELECT * from instance_ldap_config into a ticket, chat or screenshot. Even encrypted, the bind_password column does not belong outside the database. Never edit the table by hand to “fix” LDAP: the settings page runs the tests, the version check and the session sign-out that a manual UPDATE would skip.

People added from the directory who have not signed in yet (the “Waiting for first sign-in” badge):

SELECT u.name, u.email, o.name AS organization, m.role, u.created_at AS added_at
FROM "User" u
JOIN "Membership" m   ON m."userId" = u.id
JOIN "Organization" o ON o.id = m."organizationId"
WHERE u."identityProvider" = 'ldap'
  AND u."isActive" = true
  AND u."lastLoginAt" IS NULL
ORDER BY u.created_at DESC;

HiveCFM Developer Hub — internal team guide