gchq/CyberChef · error · OperationError

Invalid UUID namespace

Error message

Invalid UUID namespace

What it means

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.

Source

Thrown at src/core/operations/GenerateUUID.mjs:71

            }
        ];
    }

    /**
     * @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

  1. Provide a valid UUID string as the namespace (e.g. the standard DNS namespace 6ba7b810-9dad-11d1-80b4-00c04fd430c8).
  2. Generate a namespace UUID first with v4 if you do not have a standard one.
  3. Switch to v4 if you do not need deterministic name-based generation.

Example fix

// before
args = ["v5", "my-namespace-name"];
// after
args = ["v5", "6ba7b810-9dad-11d1-80b4-00c04fd430c8"];
Defensive patterns

Strategy: validation

Validate before calling

if (["v3", "v5"].includes(version)) {
  if (typeof namespace !== "string" || !uuid.validate(namespace)) {
    // require a valid namespace UUID before invoking
  }
}

Type guard

function isValidNamespace(uuidLib, ns) {
  return typeof ns === "string" && uuidLib.validate(ns);
}

Prevention

When it happens

Trigger: 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).

Common situations: User selects v3/v5 without realizing it requires a namespace UUID, or pastes a name string into the namespace field.

Related errors


AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13). Data as JSON: /api/errors/ec1fe55ccc7532ee. Report an issue: GitHub.