RocketChat/Rocket.Chat · error · Error

Command does not exist in the system currently: "${cmd}"

Error message

Command does not exist in the system currently: "${cmd}"

What it means

After the string check, disableCommand (commands.ts:62-66) looks up `slashCommands.commands[cmd]` (the active registry). If the command is not a registered active command it throws — you cannot disable something that does not exist. Commands previously disabled live in disabledCommands and short-circuit earlier (commands.ts:57-60).

Source

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

	}

	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
			return;
		}

		const commandObj = slashCommands.commands[cmd];

		if (typeof commandObj === 'undefined') {
			throw new Error(`Command does not exist in the system currently: "${cmd}"`);
		}

		this.disabledCommands.set(cmd, commandObj);
		delete slashCommands.commands[cmd];

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

	// command: { command, paramsExample, i18nDescription, executor: function }
	protected async modifyCommand(command: ISlashCommand, appId: string): Promise<void> {
		this.orch.debugLog(`The App ${appId} is attempting to modify the command: "${command}"`);

		this._verifyCommand(command);

		const cmd = command.command.toLowerCase();
		if (typeof slashCommands.commands[cmd] === 'undefined') {
			throw new Error(`Command does not exist in the system currently (or it is disabled): "${cmd}"`);
		}

View on GitHub (pinned to f9d3ec372b)

Solutions

  1. Verify the command exists via doesCommandExist before disabling.
  2. Use the exact registered command string (the bridge lowercases it).
  3. Ensure registerCommand completed first.

Example fix

// before
await modifier.disableCommand(cmd)
// after
if (await commandProvider.doesCommandExist(cmd)) {
  await modifier.disableCommand(cmd);
}
Defensive patterns

Strategy: validation

Validate before calling

const exists = await commandProvider.doesCommandExist(cmd);
if (exists) {
  await modifier.disableCommand(cmd);
}

Prevention

When it happens

Trigger: Disabling a command name that was never registered (typo), was unregistered, or belongs to another app and is not present in the active registry.

Common situations: Hardcoded command name that changed across versions; disabling before registerCommand completed; disabling a built-in command that is not in the registry.

Related errors


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