{"record":{"id":"89bd496df1aadc3e","repo":"gchq/CyberChef","slug":"invalid-ita2-character-errltr","errorCode":null,"errorMessage":"Invalid ITA2 character : ${errltr}","messagePattern":"Invalid ITA2 character : (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/Colossus.mjs","lineNumber":369,"sourceCode":"                type: \"number\",\n                value: 1\n            }\n        ];\n    }\n\n    /**\n     * @param {string} input\n     * @param {Object[]} args\n     * @returns {Object}\n     */\n    run(input, args) {\n        input = input.toUpperCase();\n        for (const character of input) {\n            if (VALID_ITA2.indexOf(character) === -1) {\n                let errltr = character;\n                if (errltr === \"\\n\") errltr = \"Carriage Return\";\n                if (errltr === \" \") errltr = \"Space\";\n                throw new OperationError(\"Invalid ITA2 character : \" + errltr);\n            }\n        }\n\n        const pattern = args[1];\n        const qbusin = {\n            \"Z\": args[2],\n            \"Chi\": args[3],\n            \"Psi\": args[4],\n        };\n\n        const limitation = args[5];\n        const lm = [false, false, false];\n        if (limitation.includes(\"Χ2\")) lm[0] = true;\n        if (limitation.includes(\"Ψ1\")) lm[1] = true;\n        if (limitation.includes(\"P5\")) lm[2] = true;\n        const limit = {\n            X2: lm[0], S1: lm[1], P5: lm[2]\n        };","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/Colossus.mjs#L351-L387","documentation":"Thrown by the Colossus operation when the input text contains a character not in the VALID_ITA2 alphabet. Colossus simulates the ITA2/Baudot-based Lorenz cipher, which only encodes a limited character set; any character outside VALID_ITA2 (after uppercasing) is rejected with its display name.","triggerScenarios":"Colossus.run uppercases input then scans each character against VALID_ITA2. Digits (0–9), punctuation not in ITA2, accented characters, or control chars throw. Newlines and spaces are mapped to friendly labels ('Carriage Return','Space') in the message before throwing.","commonSituations":"User feeds modern ASCII text containing digits, punctuation, or lowercase assumptions; pastes a file with non-ITA2 symbols; or forgets that ITA2 has no digits and expects numeric input to work.","solutions":["Restrict input to the ITA2 character set (letters, space, and the few supported symbols in VALID_ITA2).","Remove digits and unsupported punctuation before the operation.","Uppercase is applied automatically; still avoid letters outside the ITA2 letter range.","Consult VALID_ITA2 in the module for the authoritative allowed set."],"exampleFix":"// before — contains a digit\n// input: \"ATTACK AT 0500\"\n// after — ITA2-safe text\n// input: \"ATTACK AT DAWN\"","handlingStrategy":"validation","validationCode":"const VALID_ITA2 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ \\r\\n\" /* consult module for full set */;\nfunction isIta2Safe(text) {\n  return text.toUpperCase().split(\"\").every(c => VALID_ITA2.indexOf(c) !== -1);\n}","typeGuard":"function isIta2Safe(text) { /* as above */ }","tryCatchPattern":"null","preventionTips":["Restrict input to the ITA2 alphabet — no digits, minimal punctuation.","Consult VALID_ITA2 in the Colossus module for the authoritative set.","Pre-filter or transliterate unsupported characters before running."],"tags":["colossus","ita2","input-validation","cryptography"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}