gchq/CyberChef · error · OperationError
Unrecognised input format.
Error message
Unrecognised input format.
What it means
The Parse IPv4 Header operation accepts only 'Hex' or 'Raw' as the input format argument. This defensive else-branch fires for any other value. In the UI, the dropdown prevents invalid selection; this only triggers with programmatic or hand-edited recipe configurations.
Source
Thrown at src/core/operations/ParseIPv4Header.mjs:62
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {html}
*/
run(input, args) {
const format = args[0];
const outputFormat = args[1];
let output;
if (format === "Hex") {
input = fromHex(input);
} else if (format === "Raw") {
input = new Uint8Array(Utils.strToArrayBuffer(input));
} else {
throw new OperationError("Unrecognised input format.");
}
let ihl = input[0] & 0x0f;
const dscp = (input[1] >>> 2) & 0x3f,
ecn = input[1] & 0x03,
length = input[2] << 8 | input[3],
identification = input[4] << 8 | input[5],
flags = (input[6] >>> 5) & 0x07,
fragOffset = (input[6] & 0x1f) << 8 | input[7],
ttl = input[8],
protocol = input[9],
checksum = input[10] << 8 | input[11],
srcIP = input[12] << 24 | input[13] << 16 | input[14] << 8 | input[15],
dstIP = input[16] << 24 | input[17] << 16 | input[18] << 8 | input[19],
checksumHeader = [...input.slice(0, 10), 0, 0, ...input.slice(12, 20)];
let version = (input[0] >>> 4) & 0x0f,
options = [];
View on GitHub (pinned to 4290ea7539)
Solutions
- Set the 'Input format' argument to either 'Hex' or 'Raw'
- Validate format values programmatically before recipe execution
Defensive patterns
Strategy: validation
Validate before calling
const VALID_FORMATS = ["Hex", "Raw"];
if (!VALID_FORMATS.includes(args[0])) {
throw new Error(`Input format must be one of: ${VALID_FORMATS.join(", ")}`);
} Type guard
function isIPv4InputFormat(v) {
return v === "Hex" || v === "Raw";
} Prevention
- Validate format arguments programmatically against the allowed values before recipe execution
When it happens
Trigger: args[0] is a string other than 'Hex' or 'Raw'. Occurs when constructing recipes programmatically with an invalid format value, or hand-editing recipe JSON.
Common situations: Programmatically building a recipe with a typo in the format argument. Recipe JSON edited by hand with an incorrect value. Recipe copied between CyberChef versions with different option sets.
Related errors
- Invalid input format selected.
- Unrecognised input format.
- CIDR must be less than 32 for IPv4 or 128 for IPv6
- Invalid input format.
- IPv4 CIDR must be less than 32
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/09da07814a45d1c9.
Report an issue: GitHub.