apache/cassandra · error · InvalidRequestException
Invalid user type literal for
Error message
Invalid user type literal for %s: field %s is not of type %s
What it means
Fired per-field in validateUserTypeAssignableTo: a UDT literal field value is not assignable to the corresponding field type of the UserType (skipping nulls and matching by field position). The message names the column, the field, and the expected field type.
Solutions
- Fix the literal field value so its type matches the UDT field's declared type
- Recreate/alter the UDT or use the correct field value in the literal
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/java/org/apache/cassandra/cql3/terms/UserTypes.java:76 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/935b7248baeed5c2.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/terms/UserTypes.java:76
public static <T extends AssignmentTestable> void validateUserTypeAssignableTo(ColumnSpecification receiver,
Map<FieldIdentifier, T> entries)
{
if (!receiver.type.isUDT())
throw new InvalidRequestException(String.format("Invalid user type literal for %s of type %s", receiver, receiver.type.asCQL3Type()));
UserType ut = (UserType) receiver.type;
for (int i = 0; i < ut.size(); i++)
{
FieldIdentifier field = ut.fieldName(i);
T value = entries.get(field);
if (value == null)
continue;
ColumnSpecification fieldSpec = fieldSpecOf(receiver, i);
if (!value.testAssignment(receiver.ksName, fieldSpec).isAssignable())
{
throw new InvalidRequestException(String.format("Invalid user type literal for %s: field %s is not of type %s",
receiver, field, fieldSpec.type.asCQL3Type()));
}
}
}
/**
* Tests that the map with the specified entries can be assigned to the specified column.
*
* @param receiver the receiving column
* @param entries the map entries
*/
public static <T extends AssignmentTestable> AssignmentTestable.TestResult testUserTypeAssignment(ColumnSpecification receiver,
Map<FieldIdentifier, T> entries)
{
try
{
validateUserTypeAssignableTo(receiver, entries);
return AssignmentTestable.TestResult.WEAKLY_ASSIGNABLE;View on GitHub (pinned to 88fd0f6a0e)