apache/cassandra · error · InvalidRequestException
Invalid operation (%s) for non list column %s
Error message
Invalid operation (%s) for non list column %s
What it means
InvalidRequestException from Operation.Prepend.prepare: a prepend ('+ value on the left') update operation was applied to a column whose type is not a list. Only list columns support prepend semantics; the receiver's type is checked against ListType after preparing the value term.
Source
Thrown at src/java/org/apache/cassandra/cql3/Operation.java:466
return !(other instanceof SetValue);
}
}
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 RawDeletionView on GitHub (pinned to 88fd0f6a0e)
Solutions
- Target a list column with the prepend syntax
- For sets, use set addition: s = {x} + s
- For maps use map addition syntax
- Correct the literal to match the column's collection kind
Example fix
// before (s is set<text>)
UPDATE t SET s = ['a'] + s WHERE k=1;
// after
UPDATE t SET s = {'a'} + s 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.startsWith("list")) throw new IllegalStateException("prepend requires a list column, got " + type); Try / catch
try { session.execute(update); } catch (InvalidQueryException e) { if (e.getMessage().contains("non list column")) { /* use collection-kind-appropriate syntax */ } else throw e; } Prevention
- Use [x] + l only on list columns; use {x} + s for sets
- Confirm collection kinds after schema changes
- Keep literal syntax consistent with column kind
When it happens
Trigger: `UPDATE t SET s = [1] + s` where s is a set, map, or scalar column — prepend syntax only works on lists.
Common situations: Mixing up set/list syntax in queries; schema changed from list to set after the query was written; copy-paste between columns of different collection kinds.
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
- Value for a map addition has to be a map, but was: '%s'
- Value for a map substraction has to be a set, but was: '%s'
- Unexpected receiver type '%s'; only list and vector are expe
- Invalid list literal for %s of type %s
- Invalid list literal for %s: value %s is not of type %s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/dbfccf343aeaeaed.
Report an issue: GitHub.