{"record":{"id":"283b20390ee6ea2b","repo":"gchq/CyberChef","slug":"unsupported-input-ip-format","errorCode":null,"errorMessage":"Unsupported input IP format","messagePattern":"Unsupported input IP format","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/ChangeIPFormat.mjs","lineNumber":81,"sourceCode":"            // Convert to byte array IP from input format\n            switch (inFormat) {\n                case \"Dotted Decimal\":\n                    octets = lines[i].split(\".\");\n                    for (j = 0; j < octets.length; j++) {\n                        baIp.push(parseInt(octets[j], 10));\n                    }\n                    break;\n                case \"Decimal\":\n                    baIp = this.fromNumber(lines[i].toString(), 10);\n                    break;\n                case \"Octal\":\n                    baIp = this.fromNumber(lines[i].toString(), 8);\n                    break;\n                case \"Hex\":\n                    baIp = fromHex(lines[i]);\n                    break;\n                default:\n                    throw new OperationError(\"Unsupported input IP format\");\n            }\n\n            let ddIp;\n            let decIp;\n            let hexIp;\n\n            // Convert byte array IP to output format\n            switch (outFormat) {\n                case \"Dotted Decimal\":\n                    ddIp = \"\";\n                    for (j = 0; j < baIp.length; j++) {\n                        ddIp += baIp[j] + \".\";\n                    }\n                    output += ddIp.slice(0, ddIp.length-1) + \"\\n\";\n                    break;\n                case \"Decimal\":\n                    decIp = ((baIp[0] << 24) | (baIp[1] << 16) | (baIp[2] << 8) | baIp[3]) >>> 0;\n                    output += decIp.toString() + \"\\n\";","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/ChangeIPFormat.mjs#L63-L99","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set inFormat to exactly one of the supported enumerated values shown in the switch (mind case: e.g. 'Dotted Decimal', 'Hex', 'Decimal', 'Octal').","If building recipes programmatically, pull the option list from the operation's args definition rather than hardcoding strings.","Update stale recipes after an operation rename that changed option strings."],"exampleFix":"// before — wrong casing / unknown token\n// inFormat: \"dotted decimal\"\n// after\n// inFormat: \"Dotted Decimal\"","handlingStrategy":"validation","validationCode":"const VALID_IN_FORMATS = [\"Dotted Decimal\", \"Hex\", \"Decimal\", \"Octal\" /* + others per args def */];\nif (!VALID_IN_FORMATS.includes(inFormat)) { /* reject */ }","typeGuard":"function isKnownInFormat(f) { return VALID_IN_FORMATS.includes(f); }","tryCatchPattern":"null","preventionTips":["Use exact casing and spelling from the operation's args option list.","Pull option values from the operation metadata programmatically.","Regenerate recipes after an operation rename."],"tags":["ip-format","network","config","switch-default"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}