{"record":{"id":"b6822bca585c746e","repo":"gchq/CyberChef","slug":"4-start-must-be-between-1-and-26","errorCode":null,"errorMessage":"Χ4 start must be between 1 and 26","messagePattern":"Χ4 start must be between 1 and 26","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/Colossus.mjs","lineNumber":443,"sourceCode":"\n        // null|fast|slow for each of S1-5,M1-2,X1-5\n        const control = {\n            fast: args[43],\n            slow: args[44]\n        };\n\n        // Start positions\n        if (args[52]<1 || args[52]>43) throw new OperationError(\"Ψ1 start must be between 1 and 43\");\n        if (args[53]<1 || args[53]>47) throw new OperationError(\"Ψ2 start must be between 1 and 47\");\n        if (args[54]<1 || args[54]>51) throw new OperationError(\"Ψ3 start must be between 1 and 51\");\n        if (args[55]<1 || args[55]>53) throw new OperationError(\"Ψ4 start must be between 1 and 53\");\n        if (args[56]<1 || args[57]>59) throw new OperationError(\"Ψ5 start must be between 1 and 59\");\n        if (args[51]<1 || args[51]>37) throw new OperationError(\"Μ37 start must be between 1 and 37\");\n        if (args[50]<1 || args[50]>61) throw new OperationError(\"Μ61 start must be between 1 and 61\");\n        if (args[45]<1 || args[45]>41) throw new OperationError(\"Χ1 start must be between 1 and 41\");\n        if (args[46]<1 || args[46]>31) throw new OperationError(\"Χ2 start must be between 1 and 31\");\n        if (args[47]<1 || args[47]>29) throw new OperationError(\"Χ3 start must be between 1 and 29\");\n        if (args[48]<1 || args[48]>26) throw new OperationError(\"Χ4 start must be between 1 and 26\");\n        if (args[49]<1 || args[49]>23) throw new OperationError(\"Χ5 start must be between 1 and 23\");\n\n        const starts = {\n            X1: args[45], X2: args[46], X3: args[47], X4: args[48], X5: args[49],\n            M61: args[50], M37: args[51],\n            S1: args[52], S2: args[53], S3: args[54], S4: args[55], S5: args[56]\n        };\n\n        const colossus = new ColossusComputer(input, pattern, qbusin, qbusswitches, control, starts, settotal, limit);\n        const result = colossus.run();\n\n        return result;\n    }\n\n    /**\n     * Select Program\n     *\n     * @param {string} progname","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/Colossus.mjs#L425-L461","documentation":"Colossus simulates the Lorenz SZ cipher; the chi-4 (Χ4) wheel has exactly 26 cam positions. The start is a 1-based index enforced by `if (args[48]<1 || args[48]>26)`. Values outside [1, 26] are rejected before ColossusComputer is constructed.","triggerScenarios":"Setting the 'Χ4 start' argument (args[48]) to 0, a negative number, or an integer greater than 26.","commonSituations":"Off-by-one from 0-based indexing; confusing Χ4's 26 positions with another wheel; misaligned pasted start vector.","solutions":["Set the Χ4 start argument to an integer in the inclusive range [1, 26].","Confirm against the Lorenz SZ chi-4 wheel length of 26.","Pre-validate the full start vector against per-wheel maximums before invoking the operation."],"exampleFix":"// before\nargs[48] = 27; // throws: Χ4 start must be between 1 and 26\n// after\nargs[48] = 26; // valid: chi-4 wheel has 26 positions","handlingStrategy":"validation","validationCode":"const CHI4_START_MAX = 26;\nfunction validChi4Start(v) {\n  return Number.isInteger(v) && v >= 1 && v <= CHI4_START_MAX;\n}\nif (!validChi4Start(starts.X4)) {\n  throw new Error(`Χ4 start ${starts.X4} out of range [1, ${CHI4_START_MAX}]`);\n}","typeGuard":"function isChi4Start(v) {\n  return Number.isInteger(v) && v >= 1 && v <= 26;\n}","tryCatchPattern":null,"preventionTips":["Validate each wheel start against its fixed size before baking.","Start positions are 1-based.","Use a labeled start vector (e.g. {X4: n}) rather than positional args to avoid index mistakes."],"tags":["cyberchef","colossus","lorenz","range-check","validation","operation-error"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}