{"record":{"id":"89a4f4d3f756a91c","repo":"apache/cassandra","slug":"unable-to-make-uuid-from-s-89a4f4","errorCode":null,"errorMessage":"Unable to make UUID from '%s'","messagePattern":"Unable to make UUID from '(.+?)'","errorType":"validation","errorClass":"MarshalException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/marshal/UUIDType.java","lineNumber":193,"sourceCode":"        accessor.putLong(buffer, 8, low);\n        return buffer;\n    }\n\n    @Override\n    public boolean isValueCompatibleWithInternal(AbstractType<?> otherType)\n    {\n        return otherType instanceof UUIDType || otherType instanceof TimeUUIDType;\n    }\n\n    @Override\n    public ByteBuffer fromString(String source) throws MarshalException\n    {\n        // Return an empty ByteBuffer for an empty string.\n        ByteBuffer parsed = parse(source);\n        if (parsed != null)\n            return parsed;\n\n        throw new MarshalException(String.format(\"Unable to make UUID from '%s'\", source));\n    }\n\n    @Override\n    public CQL3Type asCQL3Type()\n    {\n        return CQL3Type.Native.UUID;\n    }\n\n    @Override\n    public TypeSerializer<UUID> getSerializer()\n    {\n        return UUIDSerializer.instance;\n    }\n\n    @Override\n    public ArgumentDeserializer getArgumentDeserializer()\n    {\n        return ARGUMENT_DESERIALIZER;","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/marshal/UUIDType.java#L175-L211","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Normalize the string to canonical UUID form (32 hex digits, dashes) before calling fromString","Use java.util.UUID.fromString in a pre-check to validate the input","Regenerate/fix the source data so ids are valid UUIDs"],"exampleFix":"// before\nUUIDType.instance.fromString(\"550e8400e29b41d4a716446655440000\"); // MarshalException\n// after\nString normalized = java.util.UUID.fromString(\n    raw.replaceFirst(\"(\\\\w{8})(\\\\w{4})(\\\\w{4})(\\\\w{4})(\\\\w{12})\", \"$1-$2-$3-$4-$5\")).toString();\nUUIDType.instance.fromString(normalized);","handlingStrategy":"validation","validationCode":"try { java.util.UUID.fromString(source); } catch (IllegalArgumentException e) { reject(source); }","typeGuard":"boolean isValidUuid(String s) { try { java.util.UUID.fromString(s); return true; } catch (IllegalArgumentException e) { return false; } }","tryCatchPattern":"try { term = UUIDType.instance.fromString(src); } catch (MarshalException e) { throw new BadRequestException(\"Invalid UUID key: \" + src); }","preventionTips":["Normalize ids to canonical UUID.toString() output before use","Validate user-supplied UUID strings at the edge","Keep ids as UUID objects end-to-end rather than as raw strings"],"tags":["cassandra","uuid","marshalling","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}