gchq/CyberChef · error · OperationError
Invalid Decode option
Error message
Invalid Decode option
What it means
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.
Source
Thrown at src/core/operations/RisonDecode.mjs:52
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {Object}
*/
run(input, args) {
const [decodeOption] = args;
switch (decodeOption) {
case "Decode":
return rison.decode(input);
case "Decode Object":
return rison.decode_object(input);
case "Decode Array":
return rison.decode_array(input);
default:
throw new OperationError("Invalid Decode option");
}
}
}
export default RisonDecode;
View on GitHub (pinned to 4290ea7539)
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.
Example fix
// before
risonDecode.run("!t:hello", ["Decode Array"])
// after — input must actually be a Rison array literal
risonDecode.run("!(hello,world)", ["Decode Array"]) Defensive patterns
Strategy: validation
Validate before calling
const VALID_DECODE = ["Decode", "Decode Object", "Decode Array"];
if (!VALID_DECODE.includes(decodeOption)) {
throw new Error(`decodeOption must be one of ${VALID_DECODE.join(", ")}`);
} Type guard
function isRisonDecodeOption(v) {
return ["Decode", "Decode Object", "Decode Array"].includes(v);
} Prevention
- Source args from the operation's constructor defaults rather than hard-coding.
- Validate the option string against the three known values before calling run().
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid encode option
- Invalid size
- Failed to set value of ingredient '${this._ingList[i].name}'
- Invalid Base64 alphabet length (${alphabet.length}): ${alpha
- Invalid value
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/5c7267d599d875b4.
Report an issue: GitHub.