{"record":{"id":"a33633f02c25ddac","repo":"apache/cassandra","slug":"table-s-s-doesn-t-exist-a33633","errorCode":null,"errorMessage":"Table '%s.%s' doesn't exist","messagePattern":"Table '(.+?)\\.(.+?)' doesn't exist","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/SchemaDescriptionStatement.java","lineNumber":88,"sourceCode":"    }\n\n    protected KeyspaceMetadata validateAndGetKeyspace(Keyspaces schema)\n    {\n        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);\n\n        if (null == keyspace)\n            throw ire(\"Keyspace '%s' doesn't exist\", keyspaceName);\n\n        return keyspace;\n    }\n\n    protected TableMetadata validateAndGetTable(Keyspaces schema, String tableName)\n    {\n        KeyspaceMetadata keyspaceMetadata = validateAndGetKeyspace(schema);\n\n        TableMetadata tableMetadata = keyspaceMetadata.getTableOrViewNullable(tableName);\n        if (null == tableMetadata)\n            throw ire(\"Table '%s.%s' doesn't exist\", keyspaceName, tableName);\n\n        if (tableMetadata.kind != REGULAR)\n            throw ire(\"Cannot set %s on non-regular table '%s.%s'\",descriptionType.value, keyspaceName, tableName);\n\n        return tableMetadata;\n    }\n\n    protected UserType validateAndGetType(Keyspaces schema, String typeName)\n    {\n        KeyspaceMetadata keyspaceMetadata = validateAndGetKeyspace(schema);\n\n        UserType type = keyspaceMetadata.types.getNullable(bytes(typeName));\n        if (null == type)\n            throw ire(\"Type '%s.%s' doesn't exist\", keyspaceName, typeName);\n\n        return type;\n    }\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/SchemaDescriptionStatement.java#L70-L106","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typos; referencing views as tables; scripts written for a different environment; case-sensitivity issues with quoted identifiers.","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"],"exampleFix":"// before\nDESCRIBE TABLE ks.metric;\n// after\nDESCRIBE TABLE ks.metrics;","handlingStrategy":"validation","validationCode":"var exists = session.execute(\"SELECT table_name FROM system_schema.tables WHERE keyspace_name=? AND table_name=?\", ks, table).iterator().hasNext();\nif (!exists) throw new IllegalArgumentException(\"Table \" + ks + \".\" + table + \" does not exist\");","typeGuard":null,"tryCatchPattern":"try { runDescription(); } catch (InvalidRequest e) { if (e.getMessage().startsWith(\"Table\") && e.getMessage().contains(\"doesn't exist\")) suggestMatchingTables(); else throw e; }","preventionTips":["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"],"tags":["cassandra","cql","table","not-found"],"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-14T16:17:12.679Z"}