apache/cassandra · error · IOException

The column family list for a snapshot should not be empty…

Error message

The column family list for a snapshot should not be empty or null

What it means

This takeSnapshot overload accepts an explicit table list and refuses to call the JMX operation when the list is null or empty, since a snapshot with no tables specified is ambiguous. It throws IOException with this message.

Solutions

  1. Pass at least one table name in the table list
  2. Guard the call: skip or fall back to whole-keyspace snapshot when the list is empty
  3. Fix the script producing the table list so it never yields an empty array

Example fix

// before
String[] tables = getTables(); // may be empty
probe.takeSnapshot(tag, options, tables);
// after
if (tables != null && tables.length > 0)
    probe.takeSnapshot(tag, options, tables);
Defensive patterns

Strategy: validation

Validate before calling

if (tableList == null || tableList.length == 0)
    throw new IllegalArgumentException("tableList must contain at least one table");

Type guard

boolean hasTables(String[] t) { return t != null && t.length > 0; }

Try / catch

try {
    probe.takeSnapshot(snapshotName, options, tableList);
} catch (IOException e) {
    if (e.getMessage().contains("should not be empty or null"))
        System.err.println("Provide at least one table name");
    else throw e;
}

Prevention

When it happens

Trigger: Calling NodeProbe.takeSnapshot (the tableList overload) with a null or zero-length table array — e.g. nodetool snapshot -cf with an empty/duplicate-filtered table list.

Common situations: Shell scripts building the -cf list from variables that expand to nothing; programmatic callers passing new String[0].

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/NodeProbe.java:1004

     * Take a snapshot of all column family from different keyspaces.
     *
     * @param snapshotName
     *            the name of the snapshot.
     * @param options
     *            Options (skipFlush for now)
     * @param tableList
     *            list of columnfamily from different keyspace in the form of ks1.cf1 ks2.cf2
     */
    public void takeMultipleTableSnapshot(String snapshotName, Map<String, String> options, String... tableList)
            throws IOException
    {
        if (null != tableList && tableList.length != 0)
        {
            snapshotProxy.takeSnapshot(snapshotName, options, tableList);
        }
        else
        {
            throw new IOException("The column family list for a snapshot should not be empty or null");
        }
    }

    /**
     * Remove all the existing snapshots of given tag for provided keyspaces.
     * When no keyspaces are specified, take all keyspaces into account. When tag is not specified (null or empty string),
     * take all tags into account.
     *
     * @param tag tag of snapshot to clear
     * @param keyspaces keyspaces to clear snapshots for
     */
    /** @deprecated See CASSANDRA-16860 */
    @Deprecated(since = "5.0")
    public void clearSnapshot(String tag, String... keyspaces) throws IOException
    {
        clearSnapshot(Collections.emptyMap(), tag, keyspaces);
    }

View on GitHub (pinned to 88fd0f6a0e)