RocketChat/Rocket.Chat · error · Error

The command is not currently disabled: "${cmd}"

Error message

The command is not currently disabled: "${cmd}"

What it means

After the string check, enableCommand (commands.ts:38-41) looks the command up in the in-memory `disabledCommands` map — commands previously moved out of the active `slashCommands.commands` registry by disableCommand. If the command is not in that map there is nothing to re-enable, so the bridge throws. enable/disable must be balanced within the same process; the map is not persisted across restarts.

Source

Thrown at apps/meteor/app/apps/server/bridges/commands.ts:40

		if (typeof command !== 'string' || command.length === 0) {
			return false;
		}

		const cmd = command.toLowerCase();

		return typeof slashCommands.commands[cmd] === 'object' || this.disabledCommands.has(cmd);
	}

	protected async enableCommand(command: string, appId: string): Promise<void> {
		this.orch.debugLog(`The App ${appId} is attempting to enable the command: "${command}"`);

		if (typeof command !== 'string' || command.trim().length === 0) {
			throw new Error('Invalid command parameter provided, must be a string.');
		}

		const cmd = command.toLowerCase();
		if (!this.disabledCommands.has(cmd)) {
			throw new Error(`The command is not currently disabled: "${cmd}"`);
		}

		slashCommands.commands[cmd] = this.disabledCommands.get(cmd) as (typeof slashCommands.commands)[string];
		this.disabledCommands.delete(cmd);

		void this.orch.getNotifier().commandUpdated(cmd);
	}

	protected async disableCommand(command: string, appId: string): Promise<void> {
		this.orch.debugLog(`The App ${appId} is attempting to disable the command: "${command}"`);

		if (typeof command !== 'string' || command.trim().length === 0) {
			throw new Error('Invalid command parameter provided, must be a string.');
		}

		const cmd = command.toLowerCase();
		if (this.disabledCommands.has(cmd)) {
			// The command is already disabled, no need to disable it yet again

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Only enable a command you previously disabled in the same process.
  2. Track disabled state inside your app rather than assuming server state.
  3. Wrap enableCommand in try/catch and treat 'not currently disabled' as a benign no-op.

Example fix

// before
await modifier.enableCommand(cmd) // throws if not disabled
// after
try {
  await modifier.enableCommand(cmd);
} catch (e) {
  // command was not disabled; safe to ignore
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await modifier.enableCommand(cmd);
} catch (e) {
  if (e instanceof Error && /not currently disabled/.test(e.message)) {
    // benign: nothing to re-enable
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling enableCommand for a command that is currently active (never disabled), already enabled, or unknown; or after a server restart where the in-memory disabledCommands map was reset.

Common situations: Server restarted (disabledCommands is not persisted) so an app's stored 'disabled' state no longer matches; double-enable; enabling a built-in command that was never disabled by the app.

Related errors


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