RocketChat/Rocket.Chat · warning · Error

LDAP_disabled

LDAP_disabled

Error message

LDAP_disabled

What it means

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.

Source

Thrown at apps/meteor/server/api/v1/ldap.ts:38

API.v1.post(
	'ldap.testConnection',
	{
		authRequired: true,
		permissionsRequired: ['test-admin-options'],
		response: {
			200: ajv.compile<{ message: string; success: true }>(messageResponseSchema),
			401: validateUnauthorizedErrorResponse,
			403: validateForbiddenErrorResponse,
		},
	},
	async function action() {
		if (!this.userId) {
			throw new Error('error-invalid-user');
		}

		if (settings.get<boolean>('LDAP_Enable') !== true) {
			throw new Error('LDAP_disabled');
		}

		try {
			await LDAP.testConnection();
		} catch (err) {
			SystemLogger.error({ err });
			throw new Error('Connection_failed');
		}

		return API.v1.success({
			message: 'LDAP_Connection_successful' as const,
		});
	},
);

API.v1.post(
	'ldap.testSearch',
	{

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Enable LDAP: in Administration > LDAP > General, set 'Enable LDAP' to true, or set the LDAP_Enable setting to true via the settings API.
  2. Verify the setting persisted by calling GET /api/v1/settings/LDAP_Enable and confirming the value is true.
  3. If using environment variables for settings, ensure LDAP_Enable=true is set and the server was restarted.

Example fix

// before: LDAP_Enable is false
// after: enable via API
PUT /api/v1/settings/LDAP_Enable
{ "value": true }
Defensive patterns

Strategy: validation

Validate before calling

// Check LDAP_Enable before calling the test endpoint
const settings = await fetch(`${baseUrl}/api/v1/settings/LDAP_Enable`, {
  headers: authHeaders
}).then(r => r.json());

if (!settings.value) {
  throw new Error('LDAP is not enabled. Enable it in Administration > LDAP before testing.');
}

Try / catch

try {
  await callLdapTestConnection();
} catch (e) {
  if (e.error === 'LDAP_disabled') {
    console.warn('LDAP is disabled — enable LDAP_Enable setting first.');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12). Data as JSON: /api/errors/df8aed16d9e80807. Report an issue: GitHub.