apache/cassandra · error · RuntimeException

Invalid option combination: Can not use split-output here

Error message

Invalid option combination: Can not use split-output here

What it means

Nodetool Compact rejects mutually exclusive options: --split-output cannot be combined with user-defined compaction (files listed as arguments) or token/partition-key ranged compaction. The command throws RuntimeException before contacting the node.

Solutions

  1. Remove --split-output when doing user-defined or token/partition-key compaction.
  2. Or drop the --user-defined / token arguments if split-output compaction of keyspaces was intended.
  3. Re-run the command with a single compaction mode.

Example fix

// before
nodetool compact --split-output --start-token -100 --end-token 100 ks
// after
nodetool compact --start-token -100 --end-token 100 ks
Defensive patterns

Strategy: validation

Validate before calling

boolean tokenProvided = !(startToken.isEmpty() && endToken.isEmpty()) || !partitionKey.isEmpty();
if (splitOutput && (userDefined || tokenProvided))
    throw new IllegalArgumentException("--split-output cannot be combined with --user-defined or tokens");

Try / catch

try { executeCompaction(...); }
catch (RuntimeException e) { if (e.getMessage().startsWith("Invalid option combination")) { printUsage(); System.exit(2); } throw e; }

Prevention

When it happens

Trigger: Running `nodetool compact --split-output` together with `--user-defined`, `--start-token`/`--end-token`, or `--partition-key`.

Common situations: Scripting a compaction command and stacking flags without understanding that split-output only applies to ordinary keyspace/table compaction.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/Compact.java:74

    @Option(paramLabel = "partition_key", names = { "--partition" }, description = "String representation of the partition key")
    private String partitionKey = EMPTY;

    @Option(paramLabel = "jobs",
            names = {"-j", "--jobs"},
            description = "Use -j to specify the maximum number of threads to use for parallel compaction. " +
                          "If not set, up to half the compaction threads will be used. " +
                          "If set to 0, the major compaction will use all threads and will not permit other compactions to run until it completes (use with caution).")
    private Integer parallelism = null;

    @Override
    public void execute(NodeProbe probe)
    {
        final boolean startEndTokenProvided = !(startToken.isEmpty() && endToken.isEmpty());
        final boolean partitionKeyProvided = !partitionKey.isEmpty();
        final boolean tokenProvided = startEndTokenProvided || partitionKeyProvided;
        if (splitOutput && (userDefined || tokenProvided))
        {
            throw new RuntimeException("Invalid option combination: Can not use split-output here");
        }
        if (userDefined && tokenProvided)
        {
            throw new RuntimeException("Invalid option combination: Can not provide tokens when using user-defined");
        }

        if (userDefined)
        {
            try
            {
                String userDefinedFiles = String.join(",", args);
                probe.forceUserDefinedCompaction(userDefinedFiles);
            } catch (Exception e) {
                throw new RuntimeException("Error occurred during user defined compaction", e);
            }
            return;
        }

View on GitHub (pinned to 88fd0f6a0e)