gchq/CyberChef · error · OperationError

Unsupported input IP format

Error message

Unsupported input IP format

What it means

Thrown in the input-format switch default case: the selected input IP format string did not match any handled case. It is a configuration-value error, not a data error — the inFormat argument itself is unrecognized.

Source

Thrown at src/core/operations/ChangeIPFormat.mjs:81

            // Convert to byte array IP from input format
            switch (inFormat) {
                case "Dotted Decimal":
                    octets = lines[i].split(".");
                    for (j = 0; j < octets.length; j++) {
                        baIp.push(parseInt(octets[j], 10));
                    }
                    break;
                case "Decimal":
                    baIp = this.fromNumber(lines[i].toString(), 10);
                    break;
                case "Octal":
                    baIp = this.fromNumber(lines[i].toString(), 8);
                    break;
                case "Hex":
                    baIp = fromHex(lines[i]);
                    break;
                default:
                    throw new OperationError("Unsupported input IP format");
            }

            let ddIp;
            let decIp;
            let hexIp;

            // Convert byte array IP to output format
            switch (outFormat) {
                case "Dotted Decimal":
                    ddIp = "";
                    for (j = 0; j < baIp.length; j++) {
                        ddIp += baIp[j] + ".";
                    }
                    output += ddIp.slice(0, ddIp.length-1) + "\n";
                    break;
                case "Decimal":
                    decIp = ((baIp[0] << 24) | (baIp[1] << 16) | (baIp[2] << 8) | baIp[3]) >>> 0;
                    output += decIp.toString() + "\n";

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Set inFormat to exactly one of the supported enumerated values shown in the switch (mind case: e.g. 'Dotted Decimal', 'Hex', 'Decimal', 'Octal').
  2. If building recipes programmatically, pull the option list from the operation's args definition rather than hardcoding strings.
  3. Update stale recipes after an operation rename that changed option strings.

Example fix

// before — wrong casing / unknown token
// inFormat: "dotted decimal"
// after
// inFormat: "Dotted Decimal"
Defensive patterns

Strategy: validation

Validate before calling

const VALID_IN_FORMATS = ["Dotted Decimal", "Hex", "Decimal", "Octal" /* + others per args def */];
if (!VALID_IN_FORMATS.includes(inFormat)) { /* reject */ }

Type guard

function isKnownInFormat(f) { return VALID_IN_FORMATS.includes(f); }

Try / catch

null

Prevention

When it happens

Trigger: ChangeIPFormat.run iterates lines and, for each, switches on inFormat over 'Dotted Decimal','Hex','Decimal','Octal' (and others above the snippet). If inFormat is none of these (typo, localized string, undefined), the default throws on the very first line.

Common situations: Recipe/config stores an inFormat value that isn't one of the supported enumerated strings — e.g. 'dotted decimal' (lowercase), 'IPv4', an empty string, or a value from a stale config schema after an operation update.

Related errors


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