{"record":{"id":"5c7267d599d875b4","repo":"gchq/CyberChef","slug":"invalid-decode-option","errorCode":null,"errorMessage":"Invalid Decode option","messagePattern":"Invalid Decode option","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/RisonDecode.mjs","lineNumber":52,"sourceCode":"        ];\n    }\n\n    /**\n     * @param {string} input\n     * @param {Object[]} args\n     * @returns {Object}\n     */\n    run(input, args) {\n        const [decodeOption] = args;\n        switch (decodeOption) {\n            case \"Decode\":\n                return rison.decode(input);\n            case \"Decode Object\":\n                return rison.decode_object(input);\n            case \"Decode Array\":\n                return rison.decode_array(input);\n            default:\n                throw new OperationError(\"Invalid Decode option\");\n        }\n    }\n}\n\nexport default RisonDecode;\n","sourceCodeStart":34,"sourceCodeEnd":58,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/RisonDecode.mjs#L34-L58","documentation":"Thrown by Rison Decode when the decodeOption argument does not match 'Decode', 'Decode Object', or 'Decode Array'. The argument is declared as an editableOption, so a user can type a custom value that fails to match any switch case.","triggerScenarios":"Programmatically invoking RisonDecode.run(input, ['Custom']) or editing the editableOption field to a value outside the three supported strings. Note: malformed Rison input is NOT this error — that surfaces as a raw rison library exception instead.","commonSituations":"Calling the operation via the Node API with a hand-built args array whose first element is misspelled or localized; a recipe export/import that captured an edited option string.","solutions":["Set the decodeOption to one of exactly: 'Decode', 'Decode Object', 'Decode Array'.","If calling via the Node API, pass args[0] from the operation's constructor default values rather than hard-coding."],"exampleFix":"// before\nrisonDecode.run(\"!t:hello\", [\"Decode Array\"])\n// after — input must actually be a Rison array literal\nrisonDecode.run(\"!(hello,world)\", [\"Decode Array\"])","handlingStrategy":"validation","validationCode":"const VALID_DECODE = [\"Decode\", \"Decode Object\", \"Decode Array\"];\nif (!VALID_DECODE.includes(decodeOption)) {\n  throw new Error(`decodeOption must be one of ${VALID_DECODE.join(\", \")}`);\n}","typeGuard":"function isRisonDecodeOption(v) {\n  return [\"Decode\", \"Decode Object\", \"Decode Array\"].includes(v);\n}","tryCatchPattern":null,"preventionTips":["Source args from the operation's constructor defaults rather than hard-coding.","Validate the option string against the three known values before calling run()."],"tags":["rison","encoding","operation","argument"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}