apache/cassandra · error · IllegalArgumentException

All sstables must be part of the same keyspace

Error message

All sstables must be part of the same keyspace

What it means

StandaloneSplitter.main groups the SSTables it was given by descriptor. If a later SSTable's descriptor keyspace name differs from the first one's, it throws IllegalArgumentException: the splitter operates on one table at a time, so mixing keyspaces is invalid input.

Solutions

  1. Run the splitter once per table, passing only SSTables of a single keyspace
  2. Fix the glob/path list to exclude SSTables from other keyspaces
  3. Check each file's Descriptor (embedded in the filename) before invoking

Example fix

// before
StandaloneSplitter data/*/users-*.db  # spans keyspaces
// after
StandaloneSplitter data/ks1/users-*.db
Defensive patterns

Strategy: validation

Validate before calling

Set<String> kss = files.stream()
    .map(f -> Descriptor.fromFilename(f).ksname)
    .collect(Collectors.toSet());
if (kss.size() != 1) throw new IllegalArgumentException("All sstables must be part of the same keyspace");

Try / catch

try { StandaloneSplitter.main(args); }
catch (IllegalArgumentException e) {
    if (e.getMessage().contains("same keyspace")) {
        // re-group inputs per keyspace and retry per table
    } else throw e;
}

Prevention

When it happens

Trigger: Passing multiple --sstables arguments (or a glob) whose Descriptor.ksname values differ; the mismatch is detected while building parsedFilenames.

Common situations: Shell glob like *.db expanding across several keyspaces' directories; copy-pasting sstable paths from different tables; scripting that collects all sstables in a snapshot directory.

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/ef518a69c269272c. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/StandaloneSplitter.java:96

            Map<Descriptor, Set<Component>> parsedFilenames = new HashMap<Descriptor, Set<Component>>();
            for (String filename : options.filenames)
            {
                File file = new File(filename);
                if (!file.exists()) {
                    System.out.println("Skipping inexisting file " + file);
                    continue;
                }

                Descriptor desc = SSTable.tryDescriptorFromFile(file);
                if (desc == null) {
                    System.out.println("Skipping non sstable file " + file);
                    continue;
                }

                if (ksName == null)
                    ksName = desc.ksname;
                else if (!ksName.equals(desc.ksname))
                    throw new IllegalArgumentException("All sstables must be part of the same keyspace");

                if (cfName == null)
                    cfName = desc.cfname;
                else if (!cfName.equals(desc.cfname))
                    throw new IllegalArgumentException("All sstables must be part of the same table");

                parsedFilenames.put(desc, desc.getComponents(Collections.emptySet(), desc.getFormat().batchComponents()));
            }

            if (ksName == null || cfName == null)
            {
                System.err.println("No valid sstables to split");
                System.exit(1);
            }

            // Do not load sstables since they might be broken
            Keyspace keyspace = Keyspace.openWithoutSSTables(ksName);
            ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);

View on GitHub (pinned to 88fd0f6a0e)