{"record":{"id":"b55953782700f9bb","repo":"gchq/CyberChef","slug":"unknown-algorithm-version-version","errorCode":null,"errorMessage":"Unknown algorithm version: ${version}","messagePattern":"Unknown algorithm version: (.+?)","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/GOSTDecrypt.mjs","lineNumber":121,"sourceCode":"        const iv = toHexFast(Utils.convertToByteArray(ivObj.string, ivObj.option));\n        input = inputType === \"Hex\" ? input : toHexFast(Utils.strToArrayBuffer(input));\n\n        let blockLength, versionNum;\n        switch (version) {\n            case \"GOST 28147 (1989)\":\n                versionNum = 1989;\n                blockLength = 64;\n                break;\n            case \"GOST R 34.12 (Magma, 2015)\":\n                versionNum = 2015;\n                blockLength = 64;\n                break;\n            case \"GOST R 34.12 (Kuznyechik, 2015)\":\n                versionNum = 2015;\n                blockLength = 128;\n                break;\n            default:\n                throw new OperationError(`Unknown algorithm version: ${version}`);\n        }\n\n        const sBoxVal = versionNum === 1989 ? sBox : null;\n\n        const algorithm = {\n            version: versionNum,\n            length: blockLength,\n            mode: \"ES\",\n            sBox: sBoxVal,\n            block: blockMode,\n            keyMeshing: keyMeshing,\n            padding: padding\n        };\n\n        try {\n            const Hex = CryptoGost.coding.Hex;\n            if (iv) algorithm.iv = Hex.decode(iv);\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GOSTDecrypt.mjs#L103-L139","documentation":"Thrown by the GOST Decrypt operation's version switch when the `Algorithm` argument string does not match one of the three supported case labels (\"GOST 28147 (1989)\", \"GOST R 34.12 (Magma, 2015)\", \"GOST R 34.12 (Kuznyechik, 2015)\"). The operation maps that label to an internal versionNum/blockLength pair; an unmatched label leaves those variables undefined, so the switch bails. In the browser UI this is normally unreachable because the value comes from a constrained `argSelector`, but via the Node API or a hand-built recipe any other string reaches the default.","triggerScenarios":"Calling chef.bake / Recipe.run with a GOST Decrypt op whose `version` arg is misspelled, differently cased, or a legacy label (e.g. \"GOST 28147-89\", \"Magma\", \"Kuznyechik\", or the raw year \"1989\"). Loading a saved recipe JSON authored against an older CyberChef version whose label text has since changed.","commonSituations":"Upgrading CyberChef and replaying an old recipe; copy-pasting an op config from docs that uses a short-form name; programmatic recipe construction that hardcodes a version string instead of reusing the op's declared `args[4].value` option list.","solutions":["Match the version string exactly to one of the three declared option labels; copy the literal from the op's args definition rather than retyping it.","If building recipes programmatically, read the allowed values from `GOSTDecrypt.args[4].value[].name` instead of string literals.","When replaying an old recipe, regenerate the GOST Decrypt step in the UI so it stores a current label."],"exampleFix":"// before\nconst recipe = [{ op: \"GOST Decrypt\", args: [key, iv, \"Hex\", \"Raw\", \"GOST 28147-89\", /*...*/] }];\n// after\nconst recipe = [{ op: \"GOST Decrypt\", args: [key, iv, \"Hex\", \"Raw\", \"GOST 28147 (1989)\", /*...*/] }];","handlingStrategy":"validation","validationCode":"const VALID_GOST_VERSIONS = [\"GOST 28147 (1989)\", \"GOST R 34.12 (Magma, 2015)\", \"GOST R 34.12 (Kuznyechik, 2015)\"];\nif (!VALID_GOST_VERSIONS.includes(version)) {\n  throw new Error(`Bad version ${JSON.stringify(version)}. Valid: ${VALID_GOST_VERSIONS.join(\", \")}`);\n}","typeGuard":"/** @param {string} v */\nfunction isGostVersion(v) {\n  return [\"GOST 28147 (1989)\", \"GOST R 34.12 (Magma, 2015)\", \"GOST R 34.12 (Kuznyechik, 2015)\"].includes(v);\n}","tryCatchPattern":null,"preventionTips":["Copy version labels from the op's declared args rather than retyping them.","When scripting, read allowed values from GOSTDecrypt.args[4].value[].name.","Regenerate older GOST Decrypt recipe steps in the UI after upgrading CyberChef."],"tags":["crypto","gost","argument-validation","recipe-config"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}