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 setinterdcstreamthroughput accepts -e/-entire-sstable (entire-SSTable throughput) and -m/-mebibytes (MiB units) as separate flags, but they are mutually exclusive because each selects a different setter on NodeProbe. Passing both is ambiguous, so execute() throws IllegalArgumentException before applying anything.

Solutions

  1. Remove either -e or -m from the command line.
  2. Use -e alone to set entire-SSTable throughput, or -m alone for MiB-based throughput.
  3. Run `nodetool help setinterdcstreamthroughput` to confirm flag semantics.

Example fix

// before
nodetool setinterdcstreamthroughput -e -m 50
// after
nodetool setinterdcstreamthroughput -m 50
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 setinterdcstreamthroughput -e -m 50 100` where both setEntireSSTableThroughput and interDCStreamThroughputInMebibytes are true.

Common situations: Users combining documentation examples for the MiB-based and entire-SSTable-based variants of the command in one invocation.

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

Appendix: source

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

import picocli.CommandLine.Parameters;

@Command(name = "setinterdcstreamthroughput", description = "Set the throughput cap for inter-datacenter streaming and entire SSTable inter-datacenter streaming in the system, or 0 to disable throttling")
public class SetInterDCStreamThroughput extends AbstractCommand
{
    @Parameters(paramLabel = "inter_dc_stream_throughput", description = "Value in megabits, 0 to disable throttling", arity = "1")
    private int interDCStreamThroughput;

    @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 interDCStreamThroughputInMebibytes;

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

        if (setEntireSSTableThroughput)
            probe.setEntireSSTableInterDCStreamThroughput(interDCStreamThroughput);
        else if (interDCStreamThroughputInMebibytes )
            probe.setInterDCStreamThroughputMiB(interDCStreamThroughput);
        else
            probe.setInterDCStreamThroughput(interDCStreamThroughput);
    }
}

View on GitHub (pinned to 88fd0f6a0e)