{"record":{"id":"518d72e75a37a8f2","repo":"apache/cassandra","slug":"unknown-keyspace-s-518d72","errorCode":null,"errorMessage":"Unknown keyspace %s","messagePattern":"Unknown keyspace (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/StandaloneScrubber.java","lineNumber":97,"sourceCode":"    /**\n     * This option was logically removed from the code, but to avoid breaking backwards compatability the option remains\n     */\n    private static final String HEADERFIX_OPTION = \"header-fix\";\n\n    public static void main(String args[])\n    {\n        Options options = Options.parseArgs(args);\n\n        if (TEST_UTIL_ALLOW_TOOL_REINIT_FOR_TEST.getBoolean())\n            DatabaseDescriptor.toolInitialization(false); //Necessary for testing\n        else\n            Util.initDatabaseDescriptor();\n        ClusterMetadataService.initializeForTools(false);\n\n        try\n        {\n            if (Schema.instance.getKeyspaceMetadata(options.keyspaceName) == null)\n                throw new IllegalArgumentException(String.format(\"Unknown keyspace %s\", options.keyspaceName));\n\n            // Do not load sstables since they might be broken\n            Keyspace keyspace = Keyspace.openWithoutSSTables(options.keyspaceName);\n\n            ColumnFamilyStore cfs = null;\n            for (ColumnFamilyStore c : keyspace.getValidColumnFamilies(true, false, options.cfName))\n            {\n                if (c.name.equals(options.cfName))\n                {\n                    cfs = c;\n                    break;\n                }\n            }\n\n            if (cfs == null)\n                throw new IllegalArgumentException(String.format(\"Unknown table %s.%s\",\n                                                                  options.keyspaceName,\n                                                                  options.cfName));","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/StandaloneScrubber.java#L79-L115","documentation":"StandaloneScrubber.main validates the keyspace name before opening it: Schema.instance.getKeyspaceMetadata(keyspaceName) must return non-null. If the keyspace does not exist in the loaded schema, it throws IllegalArgumentException, since scrubbing requires a valid keyspace definition.","triggerScenarios":"Running the standalone scrubber with a --ks (keyspace) option naming a keyspace absent from the offline-loaded schema.","commonSituations":"Typo or wrong-case keyspace name; scrubbing sstables copied from another cluster whose keyspace doesn't exist locally; keyspace dropped before running the tool.","solutions":["Check the keyspace name with cqlsh (DESCRIBE keyspaces) and fix the argument","Ensure the tool is run against the node's real schema (correct config/data dirs)","Remove the tool invocation for keyspaces that no longer exist"],"exampleFix":"// before\nStandaloneScrubber ks2 users\n// after\nStandaloneScrubber ks1 users","handlingStrategy":"validation","validationCode":"if (Schema.instance.getKeyspaceMetadata(ks) == null)\n    throw new IllegalArgumentException(\"Unknown keyspace \" + ks);","typeGuard":null,"tryCatchPattern":"try { StandaloneScrubber.main(args); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown keyspace \")) {\n        // correct the --ks argument\n    } else throw e;\n}","preventionTips":["Run DESCRIBE keyspaces first and use exact names","Remember unquoted CQL identifiers are lowercased","Only run the scrubber against keyspaces present on the local node"],"tags":["cli","schema","offline-tools"],"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"}