apache/cassandra · error · RuntimeException

Unable to find table

Error message

Unable to find table ${keyspaceName}.${tableName}

What it means

maybeLoadSchemaInfo looks up the table metadata via the Cassandra java driver's cluster metadata. If the keyspace or quoted table cannot be found (getTable returns null), a RuntimeException is thrown. This happens when the profile references a table that does not exist in the connected cluster.

Solutions

  1. Verify the keyspace and table exist with CQL: DESCRIBE KEYSPACE / DESCRIBE TABLE
  2. Correct the keyspace/table name in the stress profile YAML
  3. Ensure the cluster is connected to the right host and the schema has been created (run the profile's schema creation step)
  4. Check replication/schema agreement - a just-created schema may not have propagated yet

Example fix

# before
keyspace: ks1
table: user
# after (after creating the table in CQL)
keyspace: ks1
table: users
Defensive patterns

Strategy: validation

Validate before calling

// pre-check schema via driver session
ResultSet rs = session.execute("SELECT table_name FROM system_schema.tables WHERE keyspace_name=? AND table_name=?", keyspace, table);
if (rs.all().isEmpty()) throw new IllegalStateException("table missing: " + keyspace + "." + table);

Try / catch

try { profile.getInsert(...); } catch (RuntimeException e) { if (e.getMessage().startsWith("Unable to find table")) { createSchema(); retry(); } else throw e; }

Prevention

When it happens

Trigger: maybeLoadSchemaInfo invoked (directly or via maybeCreateSchema, maybeLoadTokenRanges, getInsert, getValidate, newGenerator) when the keyspace/table named in the stress YAML does not exist in cluster metadata.

Common situations: Typo in table or keyspace name in the YAML, schema not yet created (maybeCreateSchema failed or was skipped), connecting to the wrong cluster/datacenter, case-sensitive identifiers needing quoting.

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


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/c9f20876a88d5109. Report an issue: GitHub.

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/StressProfile.java:350

    private void maybeLoadSchemaInfo(StressSettings settings)
    {
        if (tableMetaData == null)
        {
            JavaDriverClient client = settings.getJavaDriverClient(keyspaceName);

            synchronized (client)
            {

                if (tableMetaData != null)
                    return;

                TableMetadata metadata = client.getCluster()
                                               .getMetadata()
                                               .getKeyspace(keyspaceName)
                                               .getTable(quoteIdentifier(tableName));

                if (metadata == null)
                    throw new RuntimeException("Unable to find table " + keyspaceName + "." + tableName);

                //Fill in missing column configs
                for (com.datastax.driver.core.ColumnMetadata col : metadata.getColumns())
                {
                    if (columnConfigs.containsKey(col.getName()))
                        continue;

                    columnConfigs.put(col.getName(), new GeneratorConfig(seedStr + col.getName(), null, null, null));
                }

                tableMetaData = metadata;
            }
        }
    }

    public Set<TokenRange> maybeLoadTokenRanges(StressSettings settings)
    {
        maybeLoadSchemaInfo(settings); // ensure table metadata is available

View on GitHub (pinned to 88fd0f6a0e)