apache/cassandra · error · InvalidRequestException
Table '%s.%s' doesn't exist
Error message
Table '%s.%s' doesn't exist
What it means
A schema-description statement looked up a table that does not exist in the given keyspace. validateAndGetTable first validates the keyspace, then fails on a null table lookup; it additionally rejects non-regular tables (views/index tables) for the same operation.
Source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/SchemaDescriptionStatement.java:88
}
protected KeyspaceMetadata validateAndGetKeyspace(Keyspaces schema)
{
KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
if (null == keyspace)
throw ire("Keyspace '%s' doesn't exist", keyspaceName);
return keyspace;
}
protected TableMetadata validateAndGetTable(Keyspaces schema, String tableName)
{
KeyspaceMetadata keyspaceMetadata = validateAndGetKeyspace(schema);
TableMetadata tableMetadata = keyspaceMetadata.getTableOrViewNullable(tableName);
if (null == tableMetadata)
throw ire("Table '%s.%s' doesn't exist", keyspaceName, tableName);
if (tableMetadata.kind != REGULAR)
throw ire("Cannot set %s on non-regular table '%s.%s'",descriptionType.value, keyspaceName, tableName);
return tableMetadata;
}
protected UserType validateAndGetType(Keyspaces schema, String typeName)
{
KeyspaceMetadata keyspaceMetadata = validateAndGetKeyspace(schema);
UserType type = keyspaceMetadata.types.getNullable(bytes(typeName));
if (null == type)
throw ire("Type '%s.%s' doesn't exist", keyspaceName, typeName);
return type;
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Verify the table exists: SELECT table_name FROM system_schema.tables WHERE keyspace_name='ks';
- Correct the table name and ensure the right keyspace is used
- If targeting a materialized view, use the statement/form appropriate for views rather than a regular table
Example fix
// before DESCRIBE TABLE ks.metric; // after DESCRIBE TABLE ks.metrics;
Defensive patterns
Strategy: validation
Validate before calling
var exists = session.execute("SELECT table_name FROM system_schema.tables WHERE keyspace_name=? AND table_name=?", ks, table).iterator().hasNext();
if (!exists) throw new IllegalArgumentException("Table " + ks + "." + table + " does not exist"); Try / catch
try { runDescription(); } catch (InvalidRequest e) { if (e.getMessage().startsWith("Table") && e.getMessage().contains("doesn't exist")) suggestMatchingTables(); else throw e; } Prevention
- Verify table names via system_schema.tables before describing
- Remember materialized views are not REGULAR tables — use view-appropriate statements
- Use consistent casing/quoting for identifiers across scripts
When it happens
Trigger: Running a description/validation statement with a table name not present in the keyspace; typo in the table name; passing a materialized view name where only a REGULAR table is accepted; wrong keyspace selected.
Common situations: Typos; referencing views as tables; scripts written for a different environment; case-sensitivity issues with quoted identifiers.
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
- Keyspace %s doesn't exist
- Column family {} not found
- Materialized view '%s.%s' doesn't exist
- Table '%s' doesn't exist
- Keyspace '%s' doesn't exist
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/a33633f02c25ddac.
Report an issue: GitHub.