gchq/CyberChef · error · OperationError

Invalid input format selected.

Error message

Invalid input format selected.

What it means

The Parse Ethernet Frame operation accepts only 'Hex' or 'Raw' as the input format argument. This defensive else-branch fires for any other value. In the CyberChef UI, the dropdown constrains selection to valid options, so this only occurs with programmatic or recipe-config invocations that pass an unrecognized string.

Source

Thrown at src/core/operations/ParseEthernetFrame.mjs:64

        ];
    }


    /**
     * @param {string} input
     * @param {Object[]} args
     * @returns {html}
     */
    run(input, args) {
        const format = args[0];
        const outputFormat = args[1];

        if (format === "Hex") {
            input = fromHex(input);
        } else if (format === "Raw") {
            input = new Uint8Array(Utils.strToArrayBuffer(input));
        } else {
            throw new OperationError("Invalid input format selected.");
        }

        const destinationMac = input.slice(0, 6);
        const sourceMac = input.slice(6, 12);

        let offset = 12;
        const vlans = [];

        while (offset < input.length) {
            const ethType = Utils.byteArrayToChars(input.slice(offset, offset+2));
            offset += 2;

            if (ethType === "\x81\x00" || ethType === "\x88\xA8") {
                // Parse the VLAN tag:
                // [0000] 0000 0000 0000
                //  ^^^ PRIO  - Ignored
                //     ^ DEI  - Ignored
                //        ^^^^ ^^^^ ^^^^ VLAN ID

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Set the 'Input type' argument to either 'Raw' or 'Hex'
  2. If building recipes programmatically, validate the format against the allowed values before execution
Defensive patterns

Strategy: validation

Validate before calling

const VALID_FORMATS = ["Raw", "Hex"];
if (!VALID_FORMATS.includes(args[0])) {
  throw new Error(`Input format must be one of: ${VALID_FORMATS.join(", ")}`);
}

Type guard

function isEthernetInputFormat(v) {
  return v === "Raw" || v === "Hex";
}

Prevention

When it happens

Trigger: args[0] is a string other than 'Hex' or 'Raw'. This can happen when a recipe is constructed programmatically with a typo or an unsupported format value, or when a recipe JSON is hand-edited incorrectly.

Common situations: Programmatically building a recipe with an invalid format string. Hand-editing a saved recipe JSON and mistyping the format value. Copying a recipe from an older or newer CyberChef version that supports a different option set.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/3c856af9354b35eb. Report an issue: GitHub.