{"record":{"id":"0ab6f0778ec838bd","repo":"RocketChat/Rocket.Chat","slug":"the-command-is-not-currently-disabled-cmd","errorCode":null,"errorMessage":"The command is not currently disabled: \"${cmd}\"","messagePattern":"The command is not currently disabled: \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/commands.ts","lineNumber":40,"sourceCode":"\t\tif (typeof command !== 'string' || command.length === 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst cmd = command.toLowerCase();\n\n\t\treturn typeof slashCommands.commands[cmd] === 'object' || this.disabledCommands.has(cmd);\n\t}\n\n\tprotected async enableCommand(command: string, appId: string): Promise<void> {\n\t\tthis.orch.debugLog(`The App ${appId} is attempting to enable 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\tthrow new Error(`The command is not currently disabled: \"${cmd}\"`);\n\t\t}\n\n\t\tslashCommands.commands[cmd] = this.disabledCommands.get(cmd) as (typeof slashCommands.commands)[string];\n\t\tthis.disabledCommands.delete(cmd);\n\n\t\tvoid this.orch.getNotifier().commandUpdated(cmd);\n\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","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/commands.ts#L22-L58","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Only enable a command you previously disabled in the same process.","Track disabled state inside your app rather than assuming server state.","Wrap enableCommand in try/catch and treat 'not currently disabled' as a benign no-op."],"exampleFix":"// before\nawait modifier.enableCommand(cmd) // throws if not disabled\n// after\ntry {\n  await modifier.enableCommand(cmd);\n} catch (e) {\n  // command was not disabled; safe to ignore\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await modifier.enableCommand(cmd);\n} catch (e) {\n  if (e instanceof Error && /not currently disabled/.test(e.message)) {\n    // benign: nothing to re-enable\n    return;\n  }\n  throw e;\n}","preventionTips":["Maintain your own record of commands your app disabled.","Treat enable as idempotent by swallowing the 'not disabled' error.","Do not assume disabled state survives a server restart; the map is in-memory."],"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"}