{"record":{"id":"e5d98ef08b715992","repo":"RocketChat/Rocket.Chat","slug":"invalid-slash-command-parameter-provided-it-must","errorCode":null,"errorMessage":"Invalid Slash Command parameter provided, it must be a valid ISlashCommand object.","messagePattern":"Invalid Slash Command parameter provided, it must be a valid ISlashCommand object\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/meteor/app/apps/server/bridges/commands.ts","lineNumber":139,"sourceCode":"\t}\n\n\tprotected async unregisterCommand(command: string, appId: string): Promise<void> {\n\t\tthis.orch.debugLog(`The App ${appId} is unregistering 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\tthis.disabledCommands.delete(cmd);\n\t\tdelete slashCommands.commands[cmd];\n\n\t\tvoid this.orch.getNotifier().commandRemoved(cmd);\n\t}\n\n\tprivate _verifyCommand(command: ISlashCommand): void {\n\t\tif (typeof command !== 'object') {\n\t\t\tthrow new Error('Invalid Slash Command parameter provided, it must be a valid ISlashCommand object.');\n\t\t}\n\n\t\tif (typeof command.command !== 'string') {\n\t\t\tthrow new Error('Invalid Slash Command parameter provided, it must be a valid ISlashCommand object.');\n\t\t}\n\n\t\tif (command.i18nParamsExample && typeof command.i18nParamsExample !== 'string') {\n\t\t\tthrow new Error('Invalid Slash Command parameter provided, it must be a valid ISlashCommand object.');\n\t\t}\n\n\t\tif (command.i18nDescription && typeof command.i18nDescription !== 'string') {\n\t\t\tthrow new Error('Invalid Slash Command parameter provided, it must be a valid ISlashCommand object.');\n\t\t}\n\n\t\tif (typeof command.providesPreview !== 'boolean') {\n\t\t\tthrow new Error('Invalid Slash Command parameter provided, it must be a valid ISlashCommand object.');\n\t\t}\n\t}","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/app/apps/server/bridges/commands.ts#L121-L157","documentation":"The /custom-sounds/<file> connect handler distinguishes malformed requests from unknown sounds: if the path segment after the prefix is empty (fileId falsy after stripping the query string), it responds 403 'Forbidden'. This is a URL-shape guard, not an authorization check — no sound id was supplied at all.","triggerScenarios":"GET /custom-sounds/ or /custom-sounds/?v=2 where the URL yields an empty file id; reverse proxies or rewrites that strip the segment; client code building the URL from an undefined/null variable producing an empty string.","commonSituations":"Bots and probes hitting the bare prefix; template bugs emitting empty src attributes for notification sounds; refactors that renamed the sound field to undefined.","solutions":["Always build the URL as /custom-sounds/<soundFileId>(.<ext>) with a non-empty id","Fix the client-side variable that resolved to empty/undefined before rendering the URL","Guard proxies/rewrites so the file segment survives"],"exampleFix":"// before\nconst url = `/custom-sounds/${sound && sound.file ? sound.file._id : ''}`;\n// after\nconst url = sound?.file?._id ? `/custom-sounds/${sound.file._id}.mp3` : '/sounds/chime.mp3';","handlingStrategy":"validation","validationCode":"const soundUrl = (id?: string, ext = 'mp3') => (id ? `/custom-sounds/${encodeURIComponent(id)}.${ext}` : null);","typeGuard":"const isValidSoundPath = (fileId?: string): boolean => Boolean(fileId && fileId.trim().length > 0);","tryCatchPattern":null,"preventionTips":["Never build /custom-sounds/ URLs from unvalidated optional fields","Centralize sound URL construction in one helper","Alert on 403s from the bare prefix — they indicate broken link generation"],"tags":["custom-sounds","http-403","media","url-validation"],"backgroundTag":"http-403-forbidden","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}