apache/cassandra · error · InvalidRequestException
Unknown object type: '" + objectType + "'. Valid types are:
Error message
Unknown object type: '" + objectType + "'. Valid types are: " + Arrays.toString(ObjectType.values())
What it means
After resolving the keyspace, AbstractSchemaMetadataTable parses the first key component as an ObjectType (KEYSPACE, TABLE, etc.). If the component string is not a valid ObjectType name, InvalidRequestException is thrown listing the valid types. This indicates the queried object type token is malformed.
Source
Thrown at src/java/org/apache/cassandra/db/virtual/AbstractSchemaMetadataTable.java:223
}
@Override
public DataSet data(DecoratedKey partitionKey)
{
SimpleDataSet result = new SimpleDataSet(metadata());
ByteBuffer key = partitionKey.getKey();
ByteBuffer[] components = ((CompositeType) metadata().partitionKeyType).split(key);
String objectType = UTF8Type.instance.compose(components[0]);
String keyspaceName = UTF8Type.instance.compose(components[1]);
KeyspaceMetadata keyspace = Schema.instance.getKeyspaceMetadata(keyspaceName);
if (keyspace == null)
throw new InvalidRequestException("Unknown keyspace: '" + keyspaceName + '\'');
ObjectType type = ObjectType.parse(objectType);
if (type == null)
throw new InvalidRequestException("Unknown object type: '" + objectType +
"'. Valid types are: " + Arrays.toString(ObjectType.values()));
switch (type)
{
case KEYSPACE:
addKeyspaceRow(result, keyspace);
break;
case TABLE:
for (TableMetadata table : keyspace.tables)
addTableRow(result, keyspace, table);
break;
case COLUMN:
for (TableMetadata table : keyspace.tables)
for (ColumnMetadata column : table.columns())
addColumnRow(result, keyspace, table, column);
break;
case UDT:
for (UserType udt : keyspace.types)View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Use one of the valid type strings printed in the error (match exact case, e.g. 'table', not 'tables')
- Prefer querying the dedicated system_schema tables (system_schema.tables, etc.) instead of constructing partition keys manually
- Upgrade tooling that emits object-type tokens to match this Cassandra version's ObjectType enum
Example fix
// before SELECT * FROM system_schema_virtual.tables WHERE object_type = 'view'; // after SELECT * FROM system_schema_virtual.tables WHERE object_type = 'table' AND keyspace_name = 'ks'; // or query system_schema.views directly
Defensive patterns
Strategy: validation
Validate before calling
Set<String> valid = Set.of("keyspace","table","type","function"); // per ObjectType enum
if (!valid.contains(objectType.toLowerCase())) throw new IllegalArgumentException("bad object type: " + objectType); Try / catch
try { session.execute(q); } catch (InvalidRequestException e) { if (e.getMessage().startsWith("Unknown object type")) useValidTypeFromMessage(); else throw e; } Prevention
- Query dedicated system_schema.* tables instead of constructing partition keys
- Match ObjectType names exactly (singular, correct case)
- Keep tooling in sync with the cluster's Cassandra version
When it happens
Trigger: SELECT from the schema-metadata virtual table with a partition key whose first component is a misspelled or unsupported object type, e.g. 'view' or 'index' where only enum values like keyspace/table/type/function are accepted.
Common situations: Hand-written partition-key queries against schema virtual tables using guessed type strings; tooling generating keys from internal metadata with different casing or vocabulary; version drift where newer object types don't exist in this release.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown keyspace: '" + keyspaceName + "'
- Operator %s not supported for txn_id
- Modification is not supported by table %s
- Truncation is not supported by table %s
- %s does not support complex column updates
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/5e8b325cadfaa7cc.
Report an issue: GitHub.