{"record":{"id":"143530cc5428ee4e","repo":"gchq/CyberChef","slug":"invalid-uuid-version","errorCode":null,"errorMessage":"Invalid UUID version","messagePattern":"Invalid UUID version","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/GenerateUUID.mjs","lineNumber":65,"sourceCode":"            },\n            {\n                name: \"Namespace\",\n                hint: \"UUID namespace (UUID; valid for v3 and v5)\",\n                type: \"string\",\n                value: \"1b671a64-40d5-491e-99b0-da01ff1f3341\"\n            }\n        ];\n    }\n\n    /**\n     * @param {string} input\n     * @param {Object[]} args\n     * @returns {string}\n     */\n    run(input, args) {\n        const [version, namespace] = args;\n        const hasDesiredVersion = typeof uuid[version] === \"function\";\n        if (!hasDesiredVersion) throw new OperationError(\"Invalid UUID version\");\n\n        const requiresNamespace = [\"v3\", \"v5\"].includes(version);\n        if (!requiresNamespace) return uuid[version]();\n\n        const hasValidNamespace = typeof namespace === \"string\" && uuid.validate(namespace);\n        if (!hasValidNamespace) throw new OperationError(\"Invalid UUID namespace\");\n\n        return uuid[version](input, namespace);\n    }\n\n}\n\nexport default GenerateUUID;\n","sourceCodeStart":47,"sourceCodeEnd":79,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GenerateUUID.mjs#L47-L79","documentation":"Thrown by GenerateUUID when the selected version does not correspond to a function on the uuid library object. The operation checks typeof uuid[version] === 'function'; versions v1, v3, v4, v5 (and any other callable) are accepted, anything else is rejected.","triggerScenarios":"Passing a version string like 'v6', 'v7', 'v2', 'uuid4', '4', or an empty/undefined value that is not a key naming a function on the uuid module.","commonSituations":"Recipe built with a version not in the supported set, or a UI dropdown exposing a value the installed uuid library lacks.","solutions":["Set version to one of the supported UUID generator functions exposed by the uuid library (typically v1, v3, v4, v5).","If building recipes in code, validate the version against Object.keys(uuid).filter(k => typeof uuid[k] === 'function')."],"exampleFix":"// before\nargs = [\"v6\"];\n// after\nargs = [\"v4\"];","handlingStrategy":"type-guard","validationCode":"const validVersions = Object.keys(uuid).filter(k => typeof uuid[k] === \"function\");\nif (!validVersions.includes(version)) {\n  // reject before invoking\n}","typeGuard":"function isUuidVersion(uuidLib, v) {\n  return typeof uuidLib[v] === \"function\";\n}","tryCatchPattern":null,"preventionTips":["Restrict the version control to v1, v3, v4, v5.","When building recipes programmatically, check typeof uuid[version] === 'function' first."],"tags":["uuid","argument-validation","enum","user-input"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}