{"record":{"id":"b529f2b6e2eccf3e","repo":"RocketChat/Rocket.Chat","slug":"ldap-disabled","errorCode":null,"errorMessage":"LDAP_disabled","messagePattern":"LDAP_disabled","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/ee/server/api/ldap.ts","lineNumber":40,"sourceCode":"\t\tforceTwoFactorAuthenticationForNonEnterprise: true,\n\t\ttwoFactorRequired: true,\n\t\tresponse: {\n\t\t\t200: ldapSyncNowResponseSchema,\n\t\t\t400: validateBadRequestErrorResponse,\n\t\t\t401: validateUnauthorizedErrorResponse,\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 (!(await hasPermissionAsync(this.user, 'sync-auth-services-users'))) {\n\t\t\tthrow new Error('error-not-authorized');\n\t\t}\n\n\t\tif (settings.get('LDAP_Enable') !== true) {\n\t\t\tthrow new Error('LDAP_disabled');\n\t\t}\n\n\t\tawait LDAPEnterprise.sync();\n\t\tawait LDAPEnterprise.syncAvatarAndAbacAttributes();\n\n\t\treturn API.v1.success({\n\t\t\tmessage: 'Sync_in_progress' as const,\n\t\t});\n\t},\n);\n","sourceCodeStart":22,"sourceCodeEnd":51,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/ee/server/api/ldap.ts#L22-L51","documentation":"Thrown by POST ldap.syncNow when the LDAP_Enable setting is not exactly true. The sync endpoint refuses to run because no LDAP server is configured/active, even though the user is authorized. The check is strict (=== true), so any falsy, missing, or stringly-typed value triggers it.","triggerScenarios":"Calling POST /v1/ldap.syncNow while LDAP_Enable is false, unset, or the setting was never toggled on after configuration. Also fires after LDAP was disabled for maintenance.","commonSituations":"Fresh install where LDAP was never enabled; admin disabled LDAP during a directory migration; setting reset to default after a config restore; boolean stored as a string by a migration.","solutions":["Enable LDAP in Administration > LDAP > Enable (set LDAP_Enable = true) and save.","Verify the setting value with the settings API: GET /v1/settings/LDAP_Enable should return true.","Configure LDAP connection details (host, port, base DN) before enabling, so sync is meaningful.","Re-enable LDAP if it was disabled for maintenance."],"exampleFix":"// before: sync attempted while disabled\nPOST /v1/ldap.syncNow   // LDAP_Enable = false\n\n// after: enable then sync\nPUT /v1/settings/LDAP_Enable  { \"value\": true }\nPOST /v1/ldap.syncNow","handlingStrategy":"validation","validationCode":"// Read the setting before triggering sync\nconst res = await fetch('/api/v1/settings/LDAP_Enable', { headers: authHeaders() });\nconst { value } = await res.json();\nif (value !== true) {\n  throw new Error('LDAP is disabled; enable it in Administration > LDAP first.');\n}","typeGuard":"function isLdapEnabled(value: unknown): value is true {\n  return value === true;\n}","tryCatchPattern":"try {\n  await api.post('ldap.syncNow', {});\n} catch (e) {\n  if (e.message === 'LDAP_disabled') {\n    promptEnableLdap();\n    return;\n  }\n  throw e;\n}","preventionTips":["Hide/disable the LDAP Sync button in the UI when LDAP_Enable is false.","Run a settings precondition check before batch LDAP operations."],"tags":["ldap","settings","rest-api","configuration"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}