{"record":{"id":"1b4d468d6148f093","repo":"RocketChat/Rocket.Chat","slug":"command-does-not-exist-in-the-system-currently","errorCode":null,"errorMessage":"Command does not exist in the system currently: \"${cmd}\"","messagePattern":"Command does not exist in the system currently: \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/commands.ts","lineNumber":65,"sourceCode":"\t}\n\n\tprotected async disableCommand(command: string, appId: string): Promise<void> {\n\t\tthis.orch.debugLog(`The App ${appId} is attempting to disable the command: \"${command}\"`);\n\n\t\tif (typeof command !== 'string' || command.trim().length === 0) {\n\t\t\tthrow new Error('Invalid command parameter provided, must be a string.');\n\t\t}\n\n\t\tconst cmd = command.toLowerCase();\n\t\tif (this.disabledCommands.has(cmd)) {\n\t\t\t// The command is already disabled, no need to disable it yet again\n\t\t\treturn;\n\t\t}\n\n\t\tconst commandObj = slashCommands.commands[cmd];\n\n\t\tif (typeof commandObj === 'undefined') {\n\t\t\tthrow new Error(`Command does not exist in the system currently: \"${cmd}\"`);\n\t\t}\n\n\t\tthis.disabledCommands.set(cmd, commandObj);\n\t\tdelete slashCommands.commands[cmd];\n\n\t\tvoid this.orch.getNotifier().commandDisabled(cmd);\n\t}\n\n\t// command: { command, paramsExample, i18nDescription, executor: function }\n\tprotected async modifyCommand(command: ISlashCommand, appId: string): Promise<void> {\n\t\tthis.orch.debugLog(`The App ${appId} is attempting to modify the command: \"${command}\"`);\n\n\t\tthis._verifyCommand(command);\n\n\t\tconst cmd = command.command.toLowerCase();\n\t\tif (typeof slashCommands.commands[cmd] === 'undefined') {\n\t\t\tthrow new Error(`Command does not exist in the system currently (or it is disabled): \"${cmd}\"`);\n\t\t}","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/commands.ts#L47-L83","documentation":"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).","triggerScenarios":"Disabling a command name that was never registered (typo), was unregistered, or belongs to another app and is not present in the active registry.","commonSituations":"Hardcoded command name that changed across versions; disabling before registerCommand completed; disabling a built-in command that is not in the registry.","solutions":["Verify the command exists via doesCommandExist before disabling.","Use the exact registered command string (the bridge lowercases it).","Ensure registerCommand completed first."],"exampleFix":"// before\nawait modifier.disableCommand(cmd)\n// after\nif (await commandProvider.doesCommandExist(cmd)) {\n  await modifier.disableCommand(cmd);\n}","handlingStrategy":"validation","validationCode":"const exists = await commandProvider.doesCommandExist(cmd);\nif (exists) {\n  await modifier.disableCommand(cmd);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check doesCommandExist before disable/modify.","Register commands before referencing them.","Use the exact registered command string; the bridge lowercases it."],"tags":["apps-engine","slash-command","state"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}