{"record":{"id":"df8aed16d9e80807","repo":"RocketChat/Rocket.Chat","slug":"ldap-disabled-df8aed","errorCode":"LDAP_disabled","errorMessage":"LDAP_disabled","messagePattern":"LDAP_disabled","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"warning","filePath":"apps/meteor/server/api/v1/ldap.ts","lineNumber":38,"sourceCode":"\nAPI.v1.post(\n\t'ldap.testConnection',\n\t{\n\t\tauthRequired: true,\n\t\tpermissionsRequired: ['test-admin-options'],\n\t\tresponse: {\n\t\t\t200: ajv.compile<{ message: string; success: true }>(messageResponseSchema),\n\t\t\t401: validateUnauthorizedErrorResponse,\n\t\t\t403: validateForbiddenErrorResponse,\n\t\t},\n\t},\n\tasync function action() {\n\t\tif (!this.userId) {\n\t\t\tthrow new Error('error-invalid-user');\n\t\t}\n\n\t\tif (settings.get<boolean>('LDAP_Enable') !== true) {\n\t\t\tthrow new Error('LDAP_disabled');\n\t\t}\n\n\t\ttry {\n\t\t\tawait LDAP.testConnection();\n\t\t} catch (err) {\n\t\t\tSystemLogger.error({ err });\n\t\t\tthrow new Error('Connection_failed');\n\t\t}\n\n\t\treturn API.v1.success({\n\t\t\tmessage: 'LDAP_Connection_successful' as const,\n\t\t});\n\t},\n);\n\nAPI.v1.post(\n\t'ldap.testSearch',\n\t{","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/ldap.ts#L20-L56","documentation":"Thrown by POST /api/v1/ldap.testConnection when the LDAP_Enable setting is not strictly true (boolean). The endpoint refuses to test a connection to an LDAP integration that is globally disabled, preventing misleading failures against an unconfigured directory.","triggerScenarios":"Calling the LDAP test-connection endpoint when the LDAP_Enable setting is false, unset, or not yet configured. This is a settings gate that fires before any network call.","commonSituations":"Admin testing LDAP settings before toggling the master enable switch; LDAP was disabled after a failed configuration attempt; fresh installation where LDAP has not been configured yet.","solutions":["Enable LDAP: in Administration > LDAP > General, set 'Enable LDAP' to true, or set the LDAP_Enable setting to true via the settings API.","Verify the setting persisted by calling GET /api/v1/settings/LDAP_Enable and confirming the value is true.","If using environment variables for settings, ensure LDAP_Enable=true is set and the server was restarted."],"exampleFix":"// before: LDAP_Enable is false\n// after: enable via API\nPUT /api/v1/settings/LDAP_Enable\n{ \"value\": true }","handlingStrategy":"validation","validationCode":"// Check LDAP_Enable before calling the test endpoint\nconst settings = await fetch(`${baseUrl}/api/v1/settings/LDAP_Enable`, {\n  headers: authHeaders\n}).then(r => r.json());\n\nif (!settings.value) {\n  throw new Error('LDAP is not enabled. Enable it in Administration > LDAP before testing.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await callLdapTestConnection();\n} catch (e) {\n  if (e.error === 'LDAP_disabled') {\n    console.warn('LDAP is disabled — enable LDAP_Enable setting first.');\n    return;\n  }\n  throw e;\n}","preventionTips":["Check LDAP_Enable setting before calling test-connection or test-search endpoints.","Build a pre-flight check into admin tooling that verifies LDAP is enabled before showing test buttons."],"tags":["ldap","configuration","settings"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}