{"record":{"id":"446f0f2afe60c2cc","repo":"apache/cassandra","slug":"unknown-table-cf-in-keyspace-keyspacename","errorCode":null,"errorMessage":"Unknown table '{cf}' in keyspace '{keyspaceName}'","messagePattern":"Unknown table '(.+?)' in keyspace '(.+?)'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":3463,"sourceCode":"    {\n        return getNaturalReplicasForToken(keyspaceName, partitionKeyToBytes(keyspaceName, cf, key));\n    }\n\n    public DecoratedKey getKeyFromPartition(String keyspaceName, String table, String partitionKey)\n    {\n        IPartitioner partitioner = Keyspace.open(keyspaceName).getColumnFamilyStore(table).getPartitioner();\n        return partitioner.decorateKey(partitionKeyToBytes(keyspaceName, table, partitionKey));\n    }\n\n    private static ByteBuffer partitionKeyToBytes(String keyspaceName, String cf, String key)\n    {\n        KeyspaceMetadata ksMetaData = Schema.instance.getKeyspaceMetadata(keyspaceName);\n        if (ksMetaData == null)\n            throw new IllegalArgumentException(\"Unknown keyspace '\" + keyspaceName + \"'\");\n\n        TableMetadata metadata = ksMetaData.getTableOrViewNullable(cf);\n        if (metadata == null)\n            throw new IllegalArgumentException(\"Unknown table '\" + cf + \"' in keyspace '\" + keyspaceName + \"'\");\n\n        return metadata.partitionKeyType.fromString(key);\n    }\n\n    @Override\n    public String getToken(String keyspaceName, String table, String key)\n    {\n        ColumnFamilyStore cfs = Keyspace.open(keyspaceName).getColumnFamilyStore(table);\n        return cfs.getPartitioner().getToken(partitionKeyToBytes(keyspaceName, table, key)).toString();\n    }\n\n    public EndpointsForToken getNaturalReplicasForToken(String keyspaceName, ByteBuffer key)\n    {\n        ClusterMetadata metadata = ClusterMetadata.current();\n        KeyspaceMetadata keyspaceMetadata = Keyspace.open(keyspaceName).getMetadata();\n        Token token;\n        if (keyspaceMetadata.params.replication.isMeta())\n            token = MetaStrategy.partitioner.getToken(key);","sourceCodeStart":3445,"sourceCodeEnd":3481,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L3445-L3481","documentation":"After the keyspace resolves, partitionKeyToBytes looks up the table (or materialized view) via KeyspaceMetadata.getTableOrViewNullable; a null result means the named table/view does not exist in that keyspace, so IllegalArgumentException is thrown with both table and keyspace echoed.","triggerScenarios":"Calling getToken/getNaturalEndpoints-style JMX operations with a misspelled table name, a dropped table, or a view name that no longer exists; passing a table name when only a view exists (or vice versa) after renames.","commonSituations":"Typo in table name; case-sensitive mismatch (unquoted identifiers are lowercase in CQL); table dropped between listing and lookup; scripts referencing pre-migration table names.","solutions":["List tables with cqlsh DESCRIBE TABLES / DESC <keyspace> and correct the name","Use the exact lowercase identifier unless it was quoted at creation","Check system_schema.tables to confirm the table/view exists on this node"],"exampleFix":"// before\nstorageService.getToken(\"ks\", \"UsrTbl\", \"key1\");\n// after\nstorageService.getToken(\"ks\", \"usr_tbl\", \"key1\"); // identifier verified in system_schema.tables","handlingStrategy":"validation","validationCode":"KeyspaceMetadata ksm = Schema.instance.getKeyspaceMetadata(ks);\nif (ksm == null || ksm.getTableOrViewNullable(table) == null)\n    throw new IllegalArgumentException(\"Table/view not found: \" + ks + \".\" + table);","typeGuard":null,"tryCatchPattern":"try { ss.getToken(ks, table, key); } catch (IllegalArgumentException e) { /* check table name */ }","preventionTips":["Verify table names in system_schema.tables before JMX token calls","Match identifier case exactly (lowercase unless quoted at creation)","Refresh scripts when tables are renamed or dropped"],"tags":["cassandra","schema","table","invalid-argument"],"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"}