apache/cassandra · error · InvalidRequestException
Invalid set literal for
Error message
Invalid set literal for %s of type %s
What it means
Generic validation guard in Sets.prepare: the receiver column is neither a set nor (for the empty-literal ambiguity case) a map, so a set literal cannot be assigned to it. The message names the column and its actual CQL type; the input at fault is the mismatched target column of the set literal.
Solutions
- Use a set literal only against a set-typed column; use a map literal for map columns
- Check the target column's type with DESCRIBE and correct the statement
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/java/org/apache/cassandra/cql3/terms/Sets.java:189 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/8b28c2b66ce52ce4.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/terms/Sets.java:189
values.add(t);
}
MultiElements.DelayedValue value = new MultiElements.DelayedValue((MultiElementType<?>) receiver.type.unwrap(), values);
return allTerminal ? value.bind(FunctionContext.NONE) : value;
}
private void validateAssignableTo(String keyspace, ColumnSpecification receiver) throws InvalidRequestException
{
AbstractType<?> type = receiver.type.unwrap();
if (!(type instanceof SetType))
{
// We've parsed empty maps as a set literal to break the ambiguity so
// handle that case now
if ((type instanceof MapType) && elements.isEmpty())
return;
throw new InvalidRequestException(String.format("Invalid set literal for %s of type %s", receiver.name, receiver.type.asCQL3Type()));
}
ColumnSpecification valueSpec = Sets.valueSpecOf(receiver);
for (Term.Raw rt : elements)
{
if (!rt.testAssignment(keyspace, valueSpec).isAssignable())
throw new InvalidRequestException(String.format("Invalid set literal for %s: value %s is not of type %s", receiver.name, rt, valueSpec.type.asCQL3Type()));
}
}
public AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification receiver)
{
return testSetAssignment(receiver, elements);
}
@Override
public AbstractType<?> getExactTypeIfKnown(String keyspace)
{View on GitHub (pinned to 88fd0f6a0e)