{"record":{"id":"ec1fe55ccc7532ee","repo":"gchq/CyberChef","slug":"invalid-uuid-namespace","errorCode":null,"errorMessage":"Invalid UUID namespace","messagePattern":"Invalid UUID namespace","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/GenerateUUID.mjs","lineNumber":71,"sourceCode":"            }\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":53,"sourceCodeEnd":79,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/GenerateUUID.mjs#L53-L79","documentation":"Thrown by GenerateUUID when the version is v3 or v5 (namespace-based, name-derived UUIDs) and the namespace argument is either not a string or fails uuid.validate(). A valid UUID namespace is required to deterministically derive a name-based UUID.","triggerScenarios":"Selecting v3/v5 with a missing, empty, or malformed namespace, or passing a namespace that is not itself a valid UUID (e.g. a URL or arbitrary string).","commonSituations":"User selects v3/v5 without realizing it requires a namespace UUID, or pastes a name string into the namespace field.","solutions":["Provide a valid UUID string as the namespace (e.g. the standard DNS namespace 6ba7b810-9dad-11d1-80b4-00c04fd430c8).","Generate a namespace UUID first with v4 if you do not have a standard one.","Switch to v4 if you do not need deterministic name-based generation."],"exampleFix":"// before\nargs = [\"v5\", \"my-namespace-name\"];\n// after\nargs = [\"v5\", \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\"];","handlingStrategy":"validation","validationCode":"if ([\"v3\", \"v5\"].includes(version)) {\n  if (typeof namespace !== \"string\" || !uuid.validate(namespace)) {\n    // require a valid namespace UUID before invoking\n  }\n}","typeGuard":"function isValidNamespace(uuidLib, ns) {\n  return typeof ns === \"string\" && uuidLib.validate(ns);\n}","tryCatchPattern":null,"preventionTips":["For v3/v5, always supply a valid UUID namespace (e.g. the DNS namespace 6ba7b810-9dad-11d1-80b4-00c04fd430c8).","Fall back to v4 if deterministic name-based generation is not required."],"tags":["uuid","argument-validation","namespace","user-input"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}