gchq/CyberChef · error · OperationError

Unsupported output IP format

Error message

Unsupported output IP format

What it means

Thrown in the output-format switch default case: the selected output IP format string matched none of the handled cases. Like the input error, this is an argument-configuration error — outFormat is an unrecognized enumerated value — independent of the actual IP data.

Source

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

                    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";
                    break;
                case "Octal":
                    decIp = ((baIp[0] << 24) | (baIp[1] << 16) | (baIp[2] << 8) | baIp[3]) >>> 0;
                    output += "0" + decIp.toString(8) + "\n";
                    break;
                case "Hex":
                    hexIp = "";
                    for (j = 0; j < baIp.length; j++) {
                        hexIp += Utils.hex(baIp[j]);
                    }
                    output += hexIp + "\n";
                    break;
                default:
                    throw new OperationError("Unsupported output IP format");
            }
        }

        return output.slice(0, output.length-1);
    }

    /**
     * Constructs an array of IP address octets from a numerical value.
     * @param {string} value The value of the IP address
     * @param {number} radix The numeral system to be used
     * @returns {number[]}
     */
    fromNumber(value, radix) {
        const decimal = parseInt(value, radix);
        const baIp = [];
        baIp.push(decimal >> 24 & 255);
        baIp.push(decimal >> 16 & 255);
        baIp.push(decimal >> 8 & 255);

View on GitHub (pinned to 4290ea7539)

Solutions

  1. Set outFormat to exactly one supported enumerated value with correct casing (e.g. 'Dotted Decimal', 'Hex', 'Octal', 'Decimal').
  2. Derive option strings from the operation's args metadata, not hand-typed literals.
  3. Regenerate the recipe if the operation's option set changed.

Example fix

// before
// outFormat: "binary"   // not a supported output
// after
// outFormat: "Hex"
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

function isKnownOutFormat(f) { return VALID_OUT_FORMATS.includes(f); }

Try / catch

null

Prevention

When it happens

Trigger: ChangeIPFormat.run switches on outFormat over the supported output formats; if outFormat is undefined, misspelled, or not in the set, default throws while converting the first successfully-parsed IP.

Common situations: outFormat set to a non-canonical string ('octal' lowercase, 'binary', 'integer'), undefined from a missing arg slot, or a stale recipe referencing a removed format option.

Related errors


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