gchq/CyberChef · error · OperationError
Invalid UUID version
Error message
Invalid UUID version
What it means
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.
Source
Thrown at src/core/operations/GenerateUUID.mjs:65
},
{
name: "Namespace",
hint: "UUID namespace (UUID; valid for v3 and v5)",
type: "string",
value: "1b671a64-40d5-491e-99b0-da01ff1f3341"
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
const [version, namespace] = args;
const hasDesiredVersion = typeof uuid[version] === "function";
if (!hasDesiredVersion) throw new OperationError("Invalid UUID version");
const requiresNamespace = ["v3", "v5"].includes(version);
if (!requiresNamespace) return uuid[version]();
const hasValidNamespace = typeof namespace === "string" && uuid.validate(namespace);
if (!hasValidNamespace) throw new OperationError("Invalid UUID namespace");
return uuid[version](input, namespace);
}
}
export default GenerateUUID;
View on GitHub (pinned to 4290ea7539)
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').
Example fix
// before args = ["v6"]; // after args = ["v4"];
Defensive patterns
Strategy: type-guard
Validate before calling
const validVersions = Object.keys(uuid).filter(k => typeof uuid[k] === "function");
if (!validVersions.includes(version)) {
// reject before invoking
} Type guard
function isUuidVersion(uuidLib, v) {
return typeof uuidLib[v] === "function";
} Prevention
- Restrict the version control to v1, v3, v4, v5.
- When building recipes programmatically, check typeof uuid[version] === 'function' first.
When it happens
Trigger: 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.
Common situations: Recipe built with a version not in the supported set, or a UI dropdown exposing a value the installed uuid library lacks.
Related errors
- Unsupported Mode: (${mode})
- Invalid length type
- Invalid UUID namespace
- Unknown granularity value: ${granularity}
- Invalid secret. The input must be a valid base32 string (cha
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/143530cc5428ee4e.
Report an issue: GitHub.