apache/cassandra · error · InvalidRequestException
of type has no field
Error message
%s of type %s has no field %s
What it means
Field selection resolved the receiver as a UDT, but the requested field name does not exist in the type definition: UserType.fieldPosition returns -1 and the query is rejected, naming the receiver, the UDT type, and the unknown field.
Solutions
- Check the field name against DESCRIBE TYPE / system_schema.types
- Re-sync client queries with the current UDT definition after ALTER TYPE ... RENAME/ADD
- Quote the field identifier exactly if it was created case-sensitively
Example fix
// before SELECT addr.zipcode FROM t; // UDT has 'zip' // after SELECT addr.zip FROM t;
Defensive patterns
Strategy: validation
Validate before calling
UserType ut = (UserType) col.getType().unwrap(); if (ut.fieldPosition(fieldName) < 0) throw new IllegalArgumentException(ut.getNameAsString() + " has no field " + fieldName);
Type guard
boolean hasField(UserType ut, String f) { return ut.fieldPosition(f) != -1; } Prevention
- Validate UDT field names against system_schema.types at startup
- Re-run schema validation after ALTER TYPE changes
- Be careful with quoted/case-sensitive field identifiers
When it happens
Trigger: SELECT addr.citty FROM t where the UDT 'addr' has no field named 'citty' (typo, case sensitivity, or UDT altered in a newer schema version).
Common situations: UDT fields renamed/dropped by ALTER TYPE after client code was written; schema drift between environments; case-sensitive field names (UDT fields created quoted).
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Invalid field selection
- A user type cannot contain counters
- A user type cannot contain non-frozen UDTs
- Altering field types is no longer supported
- Argument ' ' cannot be frozen; remove frozen<> modifier from
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/76cdb4e39bb6cf9d.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/selection/Selectable.java:577
BetweenParenthesesOrWithTuple betweenParentheses = (BetweenParenthesesOrWithTuple) selected;
expectedUdtType = betweenParentheses.selectables.get(0).getExactTypeIfKnown(table.keyspace);
}
Selector.Factory factory = selected.newSelectorFactory(table, expectedUdtType, defs, boundNames);
AbstractType<?> type = factory.getReturnType().unwrap();
if (!type.isUDT())
{
throw new InvalidRequestException(
String.format("Invalid field selection: %s of type %s is not a user type",
selected,
type.asCQL3Type()));
}
UserType ut = (UserType) type;
int fieldIndex = ut.fieldPosition(field);
if (fieldIndex == -1)
{
throw new InvalidRequestException(String.format("%s of type %s has no field %s",
selected, type.asCQL3Type(), field));
}
return FieldSelector.newFactory(ut, fieldIndex, factory);
}
public AbstractType<?> getExactTypeIfKnown(String keyspace)
{
AbstractType<?> selectedType = selected.getExactTypeIfKnown(keyspace);
if (selectedType == null || !(selectedType instanceof UserType))
return null;
UserType ut = (UserType) selectedType;
int fieldIndex = ut.fieldPosition(field);
if (fieldIndex == -1)
return null;
return ut.fieldType(fieldIndex);View on GitHub (pinned to 88fd0f6a0e)