apache/cassandra · error · InvalidRequestException

<id> is not a valid Transformation.Kind id

Error message

<id> is not a valid Transformation.Kind id

What it means

Thrown by the ClusterMetadataFcts Transformation.Kind function when the supplied integer id is outside the valid range [0, Transformation.Kind.values().length - 1]. The function maps a kind id to its name, and out-of-range ids are rejected with InvalidRequestException.

Source

Thrown at src/java/org/apache/cassandra/cql3/functions/ClusterMetadataFcts.java:50

    {
        functions.add(transformationKind);
    }

    public static final NativeScalarFunction transformationKind = new TransformationKind();
    private static final class TransformationKind extends NativeScalarFunction
    {

        private TransformationKind()
        {
            super("transformation_kind", UTF8Type.instance, Int32Type.instance);
        }

        @Override
        public ByteBuffer execute(Arguments arguments) throws InvalidRequestException
        {
            Number id = arguments.get(0);
            if (id.intValue() < 0 || id.intValue() > Transformation.Kind.values().length -1)
                throw new InvalidRequestException(id + " is not a valid Transformation.Kind id");

            Transformation.Kind kind = Transformation.Kind.fromId(id.intValue());
            return ByteBufferUtil.bytes(kind.name());

        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Pass an id in the valid range 0..(number of Transformation.Kind values - 1) for the running Cassandra version.
  2. Derive valid ids from the enum in the running version instead of hard-coding them.
  3. Filter out-of-range ids in the query layer before calling the function.

Example fix

// before: SELECT kindName(-1) ...; -- rejected
// after
SELECT kindName(0) ...;
Defensive patterns

Strategy: validation

Validate before calling

// Java: bound-check the id against the enum of the running version
boolean valid = id >= 0 && id <= Transformation.Kind.values().length - 1;

Try / catch

catch (InvalidRequestException e) { if (e.getMessage().endsWith("is not a valid Transformation.Kind id")) { log.warn("kind id out of range"); } }

Prevention

When it happens

Trigger: Calling the Transformation.Kind id-to-name function with n < 0 or n >= number of Transformation.Kind enum constants; typically hard-coded ids copied from a different Cassandra version.

Common situations: Scripts written against an older/newer Cassandra where the Transformation.Kind enum had different members; negative values from failed computations; iterating with an off-by-one bound.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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