{"record":{"id":"9ff754a2d6377407","repo":"apache/cassandra","slug":"unknown-keyspace-cf-pair-s-s","errorCode":null,"errorMessage":"Unknown keyspace/cf pair (%s.%s)","messagePattern":"Unknown keyspace/cf pair \\((.+?)\\.(.+?)\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/Keyspace.java","lineNumber":205,"sourceCode":"            }\n        }\n    }\n\n    public KeyspaceMetadata getMetadata()\n    {\n        return metadataRef.get();\n    }\n\n    public Collection<ColumnFamilyStore> getColumnFamilyStores()\n    {\n        return Collections.unmodifiableCollection(columnFamilyStores.values());\n    }\n\n    public ColumnFamilyStore getColumnFamilyStore(String cfName)\n    {\n        TableMetadata table = schema.getTableMetadata(getName(), cfName);\n        if (table == null)\n            throw new IllegalArgumentException(String.format(\"Unknown keyspace/cf pair (%s.%s)\", getName(), cfName));\n        return getColumnFamilyStore(table.id);\n    }\n\n    public ColumnFamilyStore getColumnFamilyStore(TableId id)\n    {\n        ColumnFamilyStore cfs = columnFamilyStores.get(id);\n        if (cfs == null)\n            throw new IllegalArgumentException(String.format(\"Unknown CF %s %s\", id, columnFamilyStores));\n        return cfs;\n    }\n\n    public ColumnFamilyStore getIfExists(TableId id)\n    {\n        return columnFamilyStores.get(id);\n    }\n\n    public boolean hasColumnFamilyStore(TableId id)\n    {","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/Keyspace.java#L187-L223","documentation":"Keyspace.getColumnFamilyStore(String) resolves a column family (table) by name through the schema. If no TableMetadata exists for the (keyspace, cfName) pair, it throws IllegalArgumentException 'Unknown keyspace/cf pair (ks.cf)'. This indicates the caller referenced a table that the schema does not know in this keyspace.","triggerScenarios":"Calling Keyspace.getColumnFamilyStore(name) (directly or via cfs/loadNewSSTables/baseCfs helpers) with a table name that was dropped, renamed, misspelled, or not yet created; also race where a table is dropped between schema lookup and use.","commonSituations":"Tooling/scripts hard-coding table names with a typo or wrong case; running SSTable loaders (loadNewSSTables) against sstables whose table was dropped; application deployed against an older schema; virtual keyspaces or system tables accessed with wrong names.","solutions":["Verify the table exists: `DESCRIBE KEYSPACE <ks>;` or query system_schema.tables — fix the name in your code/config.","Create the missing table if it should exist (`CREATE TABLE ...`) before calling operations against it.","For loadNewSSTables of orphaned sstables, restore the schema (recreate the exact table) or move the sstable files out of the data directory.","Reload the schema (`nodetool reload schema`) and retry if the node has stale schema metadata."],"exampleFix":"// before: unguarded lookup\nColumnFamilyStore cfs = keyspace.getColumnFamilyStore(\"SensorReadings\"); // wrong case\n// after: check schema first\nif (Schema.instance.getTableMetadata(keyspace.getName(), \"sensor_readings\") != null)\n    cfs = keyspace.getColumnFamilyStore(\"sensor_readings\");","handlingStrategy":"validation","validationCode":"if (Schema.instance.getTableMetadata(keyspace, table) == null)\n    throw new IllegalArgumentException(\"Table \" + keyspace + \".\" + table + \" does not exist\");\n","typeGuard":null,"tryCatchPattern":"try {\n    return keyspace.getColumnFamilyStore(cfName);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown keyspace/cf pair\"))\n        return null; // or reload schema and retry once\n    throw e;\n}\n","preventionTips":["Resolve table names from schema metadata, never hard-code case-sensitive names.","Call `nodetool reload schema` after schema changes on multi-node clusters.","Prefer Keyspace.getIfExists / Schema.getExistingTableMetadata for optional lookups."],"tags":["schema","table-not-found","illegal-argument"],"backgroundTag":"entity-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"}