apache/cassandra · error · java.lang.IllegalArgumentException

You cannot use -e and -m at the same time

Error message

You cannot use -e and -m at the same time

What it means

nodetool setstreamthroughput accepts -e/-entire-sstable (entire-SSTable throughput) and -m/-mebibytes (MiB units) as mutually exclusive flags; each maps to a different NodeProbe setter. Passing both is ambiguous and execute() throws IllegalArgumentException.

Solutions

  1. Remove either -e or -m from the command line.
  2. Use -e alone for entire-SSTable throughput or -m alone for MiB-based throughput.
  3. Check `nodetool help setstreamthroughput` for the accepted flag combinations.

Example fix

// before
nodetool setstreamthroughput -e -m 64
// after
nodetool setstreamthroughput -e 64
Defensive patterns

Strategy: validation

Validate before calling

if (args.includes('-e') && args.includes('-m')) throw new Error('Use -e or -m, not both');

Try / catch

try { probe.execute(); } catch (IllegalArgumentException e) { if (e.getMessage().contains("-e and -m")) fixFlagsAndRetry(); else throw e; }

Prevention

When it happens

Trigger: Running `nodetool setstreamthroughput -e -m 64 128` where both streamThroughput flags are set.

Common situations: Users mixing examples for the MiB-based and entire-SSTable-based variants of the throughput command.

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

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/SetStreamThroughput.java:42

import picocli.CommandLine.Parameters;

@Command(name = "setstreamthroughput", description = "Set throughput cap for streaming and entire SSTable streaming in the system, or 0 to disable throttling")
public class SetStreamThroughput extends AbstractCommand
{
    @Parameters(paramLabel = "stream_throughput", description = "Value in megabits, 0 to disable throttling", arity = "1")
    private int streamThroughput;

    @Option(names = { "-e", "--entire-sstable-throughput" }, description = "Set entire SSTable streaming throughput in MiB/s")
    private boolean setEntireSSTableThroughput;

    @Option(names = { "-m", "--mib" }, description = "Set streaming throughput in MiB/s")
    private boolean streamThroughputInMebibytes;

    @Override
    public void execute(NodeProbe probe)
    {
        if (setEntireSSTableThroughput && streamThroughputInMebibytes)
            throw new IllegalArgumentException("You cannot use -e and -m at the same time");

        if (setEntireSSTableThroughput)
            probe.setEntireSSTableStreamThroughput(streamThroughput);
        else if (streamThroughputInMebibytes )
            probe.setStreamThroughputMiB(streamThroughput);
        else
            probe.setStreamThroughput(streamThroughput);
    }
}

View on GitHub (pinned to 88fd0f6a0e)