{"record":{"id":"bfcb6a7e333552b3","repo":"apache/cassandra","slug":"unknown-keyspace","errorCode":null,"errorMessage":"Unknown keyspace ","messagePattern":"Unknown keyspace ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java","lineNumber":421,"sourceCode":"            {\n                String trimmedRawPair = rawPair.trim();\n                if (trimmedRawPair.isEmpty() || trimmedRawPair.endsWith(\".\"))\n                    throw new IllegalArgumentException(format(\"Invalid pair: '%s'\", trimmedRawPair));\n\n                String[] pair = StringUtils.split(trimmedRawPair, '.');\n\n                if (pair.length > 2)\n                    throw new IllegalArgumentException(format(\"%s property contains an item which \" +\n                                                              \"is not in format 'keyspace' or 'keyspace.table' \" +\n                                                              \"but it is '%s'\",\n                                                              COMMIT_LOG_REPLAY_LIST.getKey(),\n                                                              String.join(\".\", pair)));\n\n                String keyspaceName = pair[0];\n\n                Keyspace ks = Schema.instance.getKeyspaceInstance(keyspaceName);\n                if (ks == null)\n                    throw new IllegalArgumentException(\"Unknown keyspace \" + keyspaceName);\n\n                if (pair.length == 1)\n                {\n                    for (ColumnFamilyStore cfs : ks.getColumnFamilyStores())\n                        toReplay.put(keyspaceName, cfs.name);\n                }\n                else\n                {\n                    ColumnFamilyStore cfs = ks.getColumnFamilyStore(pair[1]);\n                    if (cfs == null)\n                        throw new IllegalArgumentException(format(\"Unknown table %s.%s\", keyspaceName, pair[1]));\n\n                    toReplay.put(keyspaceName, pair[1]);\n                }\n            }\n\n            if (toReplay.isEmpty())\n                logger.info(\"All tables will be included in commit log replay.\");","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/CommitLogReplayer.java#L403-L439","documentation":"CommitLogReplayer.create() validates each keyspace:table pair from the commit log replay filter (cassandra.commitlog_replay_files config or -Dcassandra.commitlog_replay_files). If the named keyspace does not exist in the local schema, IllegalArgumentException(\"Unknown keyspace X\") is thrown before replay begins. Cassandra refuses to replay against a nonexistent keyspace because the replay filter must reference real schema.","triggerScenarios":"Calling CommitLogReplayer.create() with a replay list entry like 'ks1:tbl1' (or 'ks1' alone) where 'ks1' is not present in Schema.instance (getKeyspaceInstance returns null).","commonSituations":"Typo in the replay filter string; keyspace was dropped or renamed before the replay; replaying commit logs on a node that never had the keyspace; wrong cluster/cassandra.yaml pointing to an empty schema; case-sensitivity confusion (non-quoted identifiers are lowercase).","solutions":["Fix the replay filter to use the exact existing keyspace name (run cqlsh 'DESCRIBE KEYSPACES' to confirm).","Recreate/restore the keyspace schema before replaying the commit logs.","Remove the stale keyspace entry from -Dcassandra.commitlog_replay_files if you only need to skip logs.","Check identifier casing: unquoted keyspaces are lowercased in Cassandra."],"exampleFix":"// before\n-Dcassandra.commitlog_replay_files=Keyspace1:Standard1\n// after (schema has lowercased name)\n-Dcassandra.commitlog_replay_files=keyspace1:standard1","handlingStrategy":"validation","validationCode":"if (Schema.instance.getKeyspaceInstance(keyspaceName) == null)\n    throw new IllegalArgumentException(\"Keyspace not found before replay: \" + keyspaceName);","typeGuard":null,"tryCatchPattern":"try {\n    CommitLogReplayer.create(...);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown keyspace\"))\n        logger.error(\"Fix commitlog_replay filter or restore schema: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Confirm keyspace exists with DESCRIBE KEYSPACES before configuring replay filters","Use lowercased unquoted identifiers in replay strings","Restore schema (from schema snapshots) before replaying commit logs"],"tags":["commitlog","replay","keyspace","startup"],"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"}