apache/cassandra · error · InvalidRequestException

Invalid operation (%s) for frozen list column %s

Error message

Invalid operation (%s) for frozen list column %s

What it means

A list prepend (`l = [x] + l`) was applied to a frozen<list<...>> column. Frozen lists are immutable as collections — only full replacement is allowed — so prepare rejects element-level prepend on non-multi-cell list columns.

Source

Thrown at src/java/org/apache/cassandra/cql3/Operation.java:468

    }

    public static class Prepend implements RawUpdate
    {
        private final Term.Raw value;

        public Prepend(Term.Raw value)
        {
            this.value = value;
        }

        public Operation prepare(TableMetadata metadata, ColumnMetadata receiver, boolean canReadExistingState) throws InvalidRequestException
        {
            Term v = value.prepare(metadata.keyspace, receiver);

            if (!(receiver.type instanceof ListType))
                throw new InvalidRequestException(String.format("Invalid operation (%s) for non list column %s", toString(receiver), receiver.name));
            else if (!(receiver.type.isMultiCell()))
                throw new InvalidRequestException(String.format("Invalid operation (%s) for frozen list column %s", toString(receiver), receiver.name));

            return new Lists.Prepender(receiver, v);
        }

        protected String toString(ColumnSpecification column)
        {
            return String.format("%s = %s - %s", column.name, value, column.name);
        }

        public boolean isCompatibleWith(RawUpdate other)
        {
            return !(other instanceof SetValue);
        }
    }

    public static class ColumnDeletion implements RawDeletion
    {
        private final ColumnIdentifier id;

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Change the column to a non-frozen list (recreate table/column) to enable prepend
  2. Replace the whole frozen list: read, modify client-side, write full value
  3. Use an append/prepend-friendly non-frozen schema going forward
  4. If frozen is required (PK usage), model history as separate rows instead

Example fix

// before
l frozen<list<int>>; UPDATE t SET l = [0] + l WHERE k=1;
// after
l list<int>; UPDATE t SET l = [0] + l WHERE k=1;
Defensive patterns

Strategy: validation

Validate before calling

String type = session.execute("SELECT type FROM system_schema.columns WHERE keyspace_name=? AND table_name=? AND column_name=?", ks, table, col).one().getString("type");
if (type.contains("frozen")) throw new IllegalStateException("frozen lists cannot be prepended; replace whole value");

Try / catch

try { session.execute(update); } catch (InvalidQueryException e) { if (e.getMessage().contains("frozen list")) { /* read-modify-write full value */ } else throw e; }

Prevention

When it happens

Trigger: `UPDATE t SET l = [x] + l` where the column is declared frozen<list<text>>.

Common situations: Column declared frozen intentionally (e.g. for use in a primary key) while queries assume mutating semantics; tutorials using non-frozen lists applied to frozen schemas.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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