{"record":{"id":"fa62d51806d52c59","repo":"apache/cassandra","slug":"s-is-not-a-type-1-time-based-uuid","errorCode":null,"errorMessage":"%s is not a Type 1 (time-based) UUID","messagePattern":"(.+?) is not a Type 1 \\(time-based\\) UUID","errorType":"exception","errorClass":"InvalidTypeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java","lineNumber":2027,"sourceCode":"    /**\n     * This codec maps a CQL {@link DataType#timeuuid()} to a Java {@link UUID}.\n     */\n    private static class TimeUUIDCodec extends AbstractUUIDCodec\n    {\n\n        private static final TimeUUIDCodec instance = new TimeUUIDCodec();\n\n        private TimeUUIDCodec()\n        {\n            super(timeuuid());\n        }\n\n        @Override\n        public String format(UUID value)\n        {\n            if (value == null) return \"NULL\";\n            if (value.version() != 1)\n                throw new InvalidTypeException(\n                String.format(\"%s is not a Type 1 (time-based) UUID\", value));\n            return super.format(value);\n        }\n\n        @Override\n        public ByteBuffer serialize(UUID value, ProtocolVersion protocolVersion)\n        {\n            if (value == null) return null;\n            if (value.version() != 1)\n                throw new InvalidTypeException(\n                String.format(\"%s is not a Type 1 (time-based) UUID\", value));\n            return super.serialize(value, protocolVersion);\n        }\n    }\n\n    /**\n     * This codec maps a CQL {@link DataType#varint()} to a Java {@link BigInteger}.\n     */","sourceCodeStart":2009,"sourceCodeEnd":2045,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java#L2009-L2045","documentation":"InvalidTypeException from TimeUUIDCodec.format: the UUID's version nibble is not 1, so it is not a time-based (Type 1) UUID and cannot be rendered/parsed as a CQL timeuuid. The codec validates version before formatting because timeuuid columns require version-1 UUIDs.","triggerScenarios":"Thrown at src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java:2027 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Generate values with the now() CQL function or UUIDs.timeBased() so version is 1","Use a uuid column type instead if arbitrary-version UUIDs must be stored","Regenerate the offending value rather than altering its version bits"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}