{"record":{"id":"94cd779be27b80da","repo":"apache/cassandra","slug":"when-specifying-the-keyspace-table-list-using-kt","errorCode":null,"errorMessage":"When specifying the Keyspace table list (using -kt,--kt-list,-kc,--kc.list), you must not also specify keyspaces to snapshot","messagePattern":"When specifying the Keyspace table list \\(using -kt,--kt-list,-kc,--kc\\.list\\), you must not also specify keyspaces to snapshot","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/Snapshot.java","lineNumber":90,"sourceCode":"            options.put(SnapshotOptions.SKIP_FLUSH, Boolean.toString(skipFlush));\n            if (null != ttl) {\n                DurationSpec.LongNanosecondsBound d = new DurationSpec.LongNanosecondsBound(ttl);\n                options.put(SnapshotOptions.TTL, d.toString());\n            }\n\n            if (!snapshotName.isEmpty() && snapshotName.contains(File.pathSeparator()))\n            {\n                throw new IOException(\"Snapshot name cannot contain \" + File.pathSeparator());\n            }\n            // Create a separate path for kclist to avoid breaking of already existing scripts\n            if (null != ktList && !ktList.isEmpty())\n            {\n                ktList = ktList.replace(\" \", \"\");\n                if (keyspaces.isEmpty() && null == table)\n                    sb.append('[').append(ktList).append(']');\n                else\n                {\n                    throw new IOException(\n                            \"When specifying the Keyspace table list (using -kt,--kt-list,-kc,--kc.list), you must not also specify keyspaces to snapshot\");\n                }\n                if (!snapshotName.isEmpty())\n                    sb.append(\" with snapshot name [\").append(snapshotName).append(']');\n                sb.append(\" and options \").append(options);\n                out.println(sb);\n                probe.takeMultipleTableSnapshot(snapshotName, options, ktList.split(\",\"));\n                out.println(\"Snapshot directory: \" + snapshotName);\n            }\n            else\n            {\n                if (keyspaces.isEmpty())\n                    sb.append(\"[all keyspaces]\");\n                else\n                    sb.append('[').append(join(keyspaces, \", \")).append(']');\n\n                if (!snapshotName.isEmpty())\n                    sb.append(\" with snapshot name [\").append(snapshotName).append(']');","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/Snapshot.java#L72-L108","documentation":"When snapshotting a specific keyspace-table list via -kt/--kt-list/-kc/--kc.list, you cannot additionally pass positional keyspace arguments or a --table filter; the table list is exclusive with the other selection mechanisms. Snapshot.execute() throws IOException when both are provided.","triggerScenarios":"Running e.g. `nodetool snapshot -kt ks1.tbl1 ks2` or `nodetool snapshot -kt ks1.tbl1 --table tbl2`, i.e. keyspaces list or table non-empty while ktList is set.","commonSituations":"Users combining the modern -kt syntax with the older positional keyspace/--table syntax in the same command, often when converting old scripts.","solutions":["Use only -kt/--kc.list with the full keyspace.table list, dropping positional keyspaces and --table.","Or drop -kt and select tables with positional keyspaces plus --table instead.","Update automation scripts to use one selection style consistently."],"exampleFix":"// before\nnodetool snapshot -kt ks1.tbl1,ks2.tbl2 ks1 --table tbl1\n// after\nnodetool snapshot -kt ks1.tbl1,ks2.tbl2","handlingStrategy":"validation","validationCode":"if (ktList != null && !ktList.isEmpty() && (!keyspaces.isEmpty() || table != null)) throw new IllegalArgumentException('-kt is mutually exclusive with positional keyspaces and --table');","typeGuard":null,"tryCatchPattern":"try { snapshot(ktList, keyspaces, table); } catch (IOException e) { if (e.getMessage().contains(\"you must not also specify keyspaces\")) dropRedundantSelectors(); else throw e; }","preventionTips":["Pick one table-selection style (-kt list OR keyspaces/--table) per command","Audit scripts migrating from old syntax to -kt for leftover positional args"],"tags":["nodetool","snapshot","conflicting-options"],"backgroundTag":"mutually-exclusive-options","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"}