{"record":{"id":"c9f20876a88d5109","repo":"apache/cassandra","slug":"unable-to-find-table-keyspacename-tablename","errorCode":null,"errorMessage":"Unable to find table ${keyspaceName}.${tableName}","messagePattern":"Unable to find table (.+?)\\.(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/StressProfile.java","lineNumber":350,"sourceCode":"    private void maybeLoadSchemaInfo(StressSettings settings)\n    {\n        if (tableMetaData == null)\n        {\n            JavaDriverClient client = settings.getJavaDriverClient(keyspaceName);\n\n            synchronized (client)\n            {\n\n                if (tableMetaData != null)\n                    return;\n\n                TableMetadata metadata = client.getCluster()\n                                               .getMetadata()\n                                               .getKeyspace(keyspaceName)\n                                               .getTable(quoteIdentifier(tableName));\n\n                if (metadata == null)\n                    throw new RuntimeException(\"Unable to find table \" + keyspaceName + \".\" + tableName);\n\n                //Fill in missing column configs\n                for (com.datastax.driver.core.ColumnMetadata col : metadata.getColumns())\n                {\n                    if (columnConfigs.containsKey(col.getName()))\n                        continue;\n\n                    columnConfigs.put(col.getName(), new GeneratorConfig(seedStr + col.getName(), null, null, null));\n                }\n\n                tableMetaData = metadata;\n            }\n        }\n    }\n\n    public Set<TokenRange> maybeLoadTokenRanges(StressSettings settings)\n    {\n        maybeLoadSchemaInfo(settings); // ensure table metadata is available","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/StressProfile.java#L332-L368","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the keyspace and table exist with CQL: DESCRIBE KEYSPACE / DESCRIBE TABLE","Correct the keyspace/table name in the stress profile YAML","Ensure the cluster is connected to the right host and the schema has been created (run the profile's schema creation step)","Check replication/schema agreement - a just-created schema may not have propagated yet"],"exampleFix":"# before\nkeyspace: ks1\ntable: user\n# after (after creating the table in CQL)\nkeyspace: ks1\ntable: users","handlingStrategy":"validation","validationCode":"// pre-check schema via driver session\nResultSet rs = session.execute(\"SELECT table_name FROM system_schema.tables WHERE keyspace_name=? AND table_name=?\", keyspace, table);\nif (rs.all().isEmpty()) throw new IllegalStateException(\"table missing: \" + keyspace + \".\" + table);","typeGuard":null,"tryCatchPattern":"try { profile.getInsert(...); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Unable to find table\")) { createSchema(); retry(); } else throw e; }","preventionTips":["DESCRIBE the keyspace/table before running stress","Ensure schema creation step completed (maybeCreateSchema)","Watch for schema-agreement delays after CREATE TABLE","Verify you connect to the intended cluster/datacenter"],"tags":["cassandra","schema","metadata"],"backgroundTag":"resource-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}