{"record":{"id":"a865583208f5df32","repo":"apache/cassandra","slug":"you-cannot-use-e-and-m-at-the-same-time-a86558","errorCode":null,"errorMessage":"You cannot use -e and -m at the same time","messagePattern":"You cannot use -e and -m at the same time","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/SetStreamThroughput.java","lineNumber":42,"sourceCode":"import picocli.CommandLine.Parameters;\n\n@Command(name = \"setstreamthroughput\", description = \"Set throughput cap for streaming and entire SSTable streaming in the system, or 0 to disable throttling\")\npublic class SetStreamThroughput extends AbstractCommand\n{\n    @Parameters(paramLabel = \"stream_throughput\", description = \"Value in megabits, 0 to disable throttling\", arity = \"1\")\n    private int streamThroughput;\n\n    @Option(names = { \"-e\", \"--entire-sstable-throughput\" }, description = \"Set entire SSTable streaming throughput in MiB/s\")\n    private boolean setEntireSSTableThroughput;\n\n    @Option(names = { \"-m\", \"--mib\" }, description = \"Set streaming throughput in MiB/s\")\n    private boolean streamThroughputInMebibytes;\n\n    @Override\n    public void execute(NodeProbe probe)\n    {\n        if (setEntireSSTableThroughput && streamThroughputInMebibytes)\n            throw new IllegalArgumentException(\"You cannot use -e and -m at the same time\");\n\n        if (setEntireSSTableThroughput)\n            probe.setEntireSSTableStreamThroughput(streamThroughput);\n        else if (streamThroughputInMebibytes )\n            probe.setStreamThroughputMiB(streamThroughput);\n        else\n            probe.setStreamThroughput(streamThroughput);\n    }\n}\n","sourceCodeStart":24,"sourceCodeEnd":52,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/SetStreamThroughput.java#L24-L52","documentation":"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.","triggerScenarios":"Running `nodetool setstreamthroughput -e -m 64 128` where both streamThroughput flags are set.","commonSituations":"Users mixing examples for the MiB-based and entire-SSTable-based variants of the throughput command.","solutions":["Remove either -e or -m from the command line.","Use -e alone for entire-SSTable throughput or -m alone for MiB-based throughput.","Check `nodetool help setstreamthroughput` for the accepted flag combinations."],"exampleFix":"// before\nnodetool setstreamthroughput -e -m 64\n// after\nnodetool setstreamthroughput -e 64","handlingStrategy":"validation","validationCode":"if (args.includes('-e') && args.includes('-m')) throw new Error('Use -e or -m, not both');","typeGuard":null,"tryCatchPattern":"try { probe.execute(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"-e and -m\")) fixFlagsAndRetry(); else throw e; }","preventionTips":["Never combine -e and -m in generated commands","Check help output when porting commands between setstreamthroughput and setinterdcstreamthroughput"],"tags":["nodetool","cli","mutually-exclusive"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T20:17:13.540Z"}