apache/cassandra · error · java.io.IOException

Snapshot name cannot contain

Error message

Snapshot name cannot contain 

What it means

nodetool snapshots names become directory names on disk, so they must not contain the platform path separator. If a non-empty snapshot name contains File.pathSeparator() (':' on Unix), execute() throws IOException before taking the snapshot.

Solutions

  1. Choose a snapshot name without the path separator character (avoid ':').
  2. Replace ':' in generated names, e.g. use dots or dashes for timestamps: snap-2026-09-10T12-00-00.
  3. Validate the name in any scripts that generate snapshot names.

Example fix

// before
nodetool snapshot -n snap:2026-09-10
// after
nodetool snapshot -n snap-2026-09-10
Defensive patterns

Strategy: validation

Validate before calling

if (snapshotName.contains(File.pathSeparator())) throw new IllegalArgumentException("Snapshot name cannot contain " + File.pathSeparator());

Try / catch

try { nodetoolSnapshot(name); } catch (IOException e) { if (e.getMessage().startsWith("Snapshot name cannot contain")) sanitize(name); else throw e; }

Prevention

When it happens

Trigger: Running `nodetool snapshot -n my:snapshot` (or any name containing ':') on Linux/macOS.

Common situations: Users embedding timestamps like '2026-09-10T12:00:00' in snapshot names, since ISO timestamps contain colons.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/6e1a45bc1f8e6582. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/Snapshot.java:80

    public void execute(NodeProbe probe)
    {
        PrintStream out = probe.output().out;
        try
        {
            StringBuilder sb = new StringBuilder();

            sb.append("Requested creating snapshot(s) for ");

            Map<String, String> options = new HashMap<String,String>();
            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);

View on GitHub (pinned to 88fd0f6a0e)