{"record":{"id":"69746612de4e9071","repo":"RocketChat/Rocket.Chat","slug":"command-does-not-exist-in-the-system-currently-or","errorCode":null,"errorMessage":"Command does not exist in the system currently (or it is disabled): \"${cmd}\"","messagePattern":"Command does not exist in the system currently \\(or it is disabled\\): \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/commands.ts","lineNumber":82,"sourceCode":"\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}\n\n\t\tconst item = slashCommands.commands[cmd];\n\n\t\titem.params = command.i18nParamsExample ? command.i18nParamsExample : item.params;\n\t\titem.description = command.i18nDescription ? command.i18nDescription : item.params;\n\t\titem.callback = this._appCommandExecutor.bind(this);\n\t\titem.providesPreview = command.providesPreview;\n\t\titem.previewer = command.previewer ? this._appCommandPreviewer.bind(this) : item.previewer;\n\t\titem.previewCallback = (\n\t\t\tcommand.executePreviewItem ? this._appCommandPreviewExecutor.bind(this) : item.previewCallback\n\t\t) as (typeof slashCommands.commands)[string]['previewCallback'];\n\n\t\tslashCommands.commands[cmd] = item;\n\t\tvoid this.orch.getNotifier().commandUpdated(cmd);\n\t}\n\n\tprotected async registerCommand(command: ISlashCommand, appId: string): Promise<void> {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/commands.ts#L64-L100","documentation":"`modifyCommand(command: ISlashCommand)` (commands.ts:75-83) updates an existing slash command. After `_verifyCommand` it lowercases `command.command` and looks it up in `slashCommands.commands`. If absent it throws — the command must be present AND not currently disabled, because disabled commands are parked in disabledCommands, not slashCommands.commands. A command therefore cannot be modified while disabled.","triggerScenarios":"Modifying a command that is currently disabled, never registered, was unregistered, or whose name changed.","commonSituations":"App tries to update its own command while a prior disable parked it; modify fired on startup before registration completed; command-name drift after a rename.","solutions":["Re-enable the command before modifying it.","Confirm registerCommand completed and the command sits in the active registry.","Use the exact registered command string."],"exampleFix":"// before\nawait modifier.modifyCommand(updatedCmd) // command is currently disabled\n// after\nawait modifier.enableCommand(updatedCmd.command); // re-enable first\nawait modifier.modifyCommand(updatedCmd);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await modifier.modifyCommand(updatedCmd);\n} catch (e) {\n  if (e instanceof Error && /does not exist in the system currently/.test(e.message)) {\n    // likely disabled: re-enable then retry\n    await modifier.enableCommand(updatedCmd.command).catch(() => {});\n    await modifier.modifyCommand(updatedCmd);\n    return;\n  }\n  throw e;\n}","preventionTips":["Avoid modifying commands you have disabled; re-enable first.","Keep command lifecycle calls ordered: register -> modify -> disable -> enable.","Note doesCommandExist returns true for disabled commands, so it cannot prevent this error alone."],"tags":["apps-engine","slash-command","state"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}