apache/cassandra · error · InvalidTypeException

is not a Type 1 (time-based) UUID

Error message

%s is not a Type 1 (time-based) UUID

What it means

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.

Solutions

  1. Generate values with the now() CQL function or UUIDs.timeBased() so version is 1
  2. Use a uuid column type instead if arbitrary-version UUIDs must be stored
  3. Regenerate the offending value rather than altering its version bits
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java:2027 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java:2027

    /**
     * This codec maps a CQL {@link DataType#timeuuid()} to a Java {@link UUID}.
     */
    private static class TimeUUIDCodec extends AbstractUUIDCodec
    {

        private static final TimeUUIDCodec instance = new TimeUUIDCodec();

        private TimeUUIDCodec()
        {
            super(timeuuid());
        }

        @Override
        public String format(UUID value)
        {
            if (value == null) return "NULL";
            if (value.version() != 1)
                throw new InvalidTypeException(
                String.format("%s is not a Type 1 (time-based) UUID", value));
            return super.format(value);
        }

        @Override
        public ByteBuffer serialize(UUID value, ProtocolVersion protocolVersion)
        {
            if (value == null) return null;
            if (value.version() != 1)
                throw new InvalidTypeException(
                String.format("%s is not a Type 1 (time-based) UUID", value));
            return super.serialize(value, protocolVersion);
        }
    }

    /**
     * This codec maps a CQL {@link DataType#varint()} to a Java {@link BigInteger}.
     */

View on GitHub (pinned to 88fd0f6a0e)