apache/cassandra · error · java.io.IOException
When specifying the Keyspace table list (using…
Error message
When specifying the Keyspace table list (using -kt,--kt-list,-kc,--kc.list), you must not also specify keyspaces to snapshot
What it means
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.
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.
Example fix
// before nodetool snapshot -kt ks1.tbl1,ks2.tbl2 ks1 --table tbl1 // after nodetool snapshot -kt ks1.tbl1,ks2.tbl2
Defensive patterns
Strategy: validation
Validate before calling
if (ktList != null && !ktList.isEmpty() && (!keyspaces.isEmpty() || table != null)) throw new IllegalArgumentException('-kt is mutually exclusive with positional keyspaces and --table'); Try / catch
try { snapshot(ktList, keyspaces, table); } catch (IOException e) { if (e.getMessage().contains("you must not also specify keyspaces")) dropRedundantSelectors(); else throw e; } Prevention
- Pick one table-selection style (-kt list OR keyspaces/--table) per command
- Audit scripts migrating from old syntax to -kt for leftover positional args
When it happens
Trigger: 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.
Common situations: Users combining the modern -kt syntax with the older positional keyspace/--table syntax in the same command, often when converting old scripts.
Related errors
- Error during taking a snapshot
- Parameter older_than_timestamp has to be a valid instant in…
- Replication factor should not be set if previous operation…
- Snapshot name cannot contain
- argument for sort must be one of
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/94cd779be27b80da.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/tools/nodetool/Snapshot.java:90
options.put(SnapshotOptions.SKIP_FLUSH, Boolean.toString(skipFlush));
if (null != ttl) {
DurationSpec.LongNanosecondsBound d = new DurationSpec.LongNanosecondsBound(ttl);
options.put(SnapshotOptions.TTL, d.toString());
}
if (!snapshotName.isEmpty() && snapshotName.contains(File.pathSeparator()))
{
throw new IOException("Snapshot name cannot contain " + File.pathSeparator());
}
// Create a separate path for kclist to avoid breaking of already existing scripts
if (null != ktList && !ktList.isEmpty())
{
ktList = ktList.replace(" ", "");
if (keyspaces.isEmpty() && null == table)
sb.append('[').append(ktList).append(']');
else
{
throw new IOException(
"When specifying the Keyspace table list (using -kt,--kt-list,-kc,--kc.list), you must not also specify keyspaces to snapshot");
}
if (!snapshotName.isEmpty())
sb.append(" with snapshot name [").append(snapshotName).append(']');
sb.append(" and options ").append(options);
out.println(sb);
probe.takeMultipleTableSnapshot(snapshotName, options, ktList.split(","));
out.println("Snapshot directory: " + snapshotName);
}
else
{
if (keyspaces.isEmpty())
sb.append("[all keyspaces]");
else
sb.append('[').append(join(keyspaces, ", ")).append(']');
if (!snapshotName.isEmpty())
sb.append(" with snapshot name [").append(snapshotName).append(']');View on GitHub (pinned to 88fd0f6a0e)