{"record":{"id":"2c8337b54b22a69f","repo":"RocketChat/Rocket.Chat","slug":"invalid-command-parameter-provided-must-be-a-stri","errorCode":null,"errorMessage":"Invalid command parameter provided, must be a string.","messagePattern":"Invalid command parameter provided, must be a string\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/app/apps/server/bridges/commands.ts","lineNumber":35,"sourceCode":"\t}\n\n\tprotected async doesCommandExist(command: string, appId: string): Promise<boolean> {\n\t\tthis.orch.debugLog(`The App ${appId} is checking if \"${command}\" command exists.`);\n\n\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.');","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/app/apps/server/bridges/commands.ts#L17-L53","documentation":"`AppCommandsBridge.enableCommand(command, appId)` (commands.ts:31-36) re-enables a previously disabled slash command. Its first guard rejects a `command` that is not a non-empty trimmed string. enableCommand is reached via the apps-engine command-modifier accessor; passing anything but a real command name aborts here before any state lookup.","triggerScenarios":"Calling the command modifier's enable with undefined, a number, an object, or a whitespace-only string — e.g. `getSlashCommandModifier().enableCommand(nameFromConfig)` where nameFromConfig is undefined.","commonSituations":"App reads the command name from settings/storage that is unset; a programmatic command lookup returned undefined and was passed through; refactor changed the variable type.","solutions":["Pass a concrete, non-empty command string.","Guard with `typeof command === 'string' && command.trim().length > 0` before calling enable.","Confirm the command was previously disabled (see error 3) in the same process."],"exampleFix":"// before\nmodifier.enableCommand(name) // name is undefined\n// after\nif (typeof name === 'string' && name.trim()) {\n  await modifier.enableCommand(name);\n}","handlingStrategy":"validation","validationCode":"const cmd = asCommandName(rawValue);\nif (cmd) {\n  await modifier.enableCommand(cmd);\n}","typeGuard":"const isCommandName = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;\n\nfunction asCommandName(v: unknown): string | null {\n  return isCommandName(v) ? v : null;\n}","tryCatchPattern":null,"preventionTips":["Normalize command names to non-empty strings at the boundary of your app.","Avoid passing values read from settings/storage without a type check.","Centralize command lifecycle calls behind a helper that validates the name."],"tags":["apps-engine","slash-command","validation"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}