apache/cassandra · error · MarshalException

Unable to make UUID from '%s'

Error message

Unable to make UUID from '%s'

What it means

UUIDType.fromString cannot build a UUID ByteBuffer from the given source string. parse() returns null (empty input handled, or UUID.fromString failed), so this error is raised naming the offending string.

Source

Thrown at src/java/org/apache/cassandra/db/marshal/UUIDType.java:193

        accessor.putLong(buffer, 8, low);
        return buffer;
    }

    @Override
    public boolean isValueCompatibleWithInternal(AbstractType<?> otherType)
    {
        return otherType instanceof UUIDType || otherType instanceof TimeUUIDType;
    }

    @Override
    public ByteBuffer fromString(String source) throws MarshalException
    {
        // Return an empty ByteBuffer for an empty string.
        ByteBuffer parsed = parse(source);
        if (parsed != null)
            return parsed;

        throw new MarshalException(String.format("Unable to make UUID from '%s'", source));
    }

    @Override
    public CQL3Type asCQL3Type()
    {
        return CQL3Type.Native.UUID;
    }

    @Override
    public TypeSerializer<UUID> getSerializer()
    {
        return UUIDSerializer.instance;
    }

    @Override
    public ArgumentDeserializer getArgumentDeserializer()
    {
        return ARGUMENT_DESERIALIZER;

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Normalize the string to canonical UUID form (32 hex digits, dashes) before calling fromString
  2. Use java.util.UUID.fromString in a pre-check to validate the input
  3. Regenerate/fix the source data so ids are valid UUIDs

Example fix

// before
UUIDType.instance.fromString("550e8400e29b41d4a716446655440000"); // MarshalException
// after
String normalized = java.util.UUID.fromString(
    raw.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5")).toString();
UUIDType.instance.fromString(normalized);
Defensive patterns

Strategy: validation

Validate before calling

try { java.util.UUID.fromString(source); } catch (IllegalArgumentException e) { reject(source); }

Type guard

boolean isValidUuid(String s) { try { java.util.UUID.fromString(s); return true; } catch (IllegalArgumentException e) { return false; } }

Try / catch

try { term = UUIDType.instance.fromString(src); } catch (MarshalException e) { throw new BadRequestException("Invalid UUID key: " + src); }

Prevention

When it happens

Trigger: Calling UUIDType.fromString with a string that is not a canonical UUID, e.g. 'abc123', '550e8400-e29b-41d4' (truncated), or a UUID with wrong variant bits.

Common situations: Application stores UUIDs without dashes or uppercase-with-whitespace; data migrated from another system using non-canonical id formats; user-supplied key containing a typo.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/89a4f4d3f756a91c. Report an issue: GitHub.