apache/cassandra · error · RuntimeException

Use the -d flag to quiet this error and get the exact…

Error message

Use the -d flag to quiet this error and get the exact throughput in megabits/s

What it means

When the stream throughput value is not a whole number and no flag forced exact display, getstreamthroughput refuses to print a rounded Mb/s value and throws a RuntimeException telling the user to re-run with -d to get the exact megabits/s figure. It is a deliberate guard against silently lossy output.

Solutions

  1. Re-run with the -d/--double flag to print the exact throughput in megabits/s.
  2. Set the throughput to a value whose Mb/s conversion is a whole number.
  3. Read the value via JMX directly if scripting needs the exact double.

Example fix

// before
nodetool getstreamthroughput  # throws for fractional Mb/s
// after
nodetool getstreamthroughput -d
Defensive patterns

Strategy: fallback

Validate before calling

# Prefer the exact form when scripting
value=$(nodetool getstreamthroughput -d)

Try / catch

try:
    out = run(['nodetool','getstreamthroughput'])
except RuntimeError:
    out = run(['nodetool','getstreamthroughput','-d'])  # exact Mb/s

Prevention

When it happens

Trigger: Running `nodetool getstreamthroughput -d`-equivalent path (or an Mbit display path) where the configured throughput, converted to Mb/s, has a fractional part (e.g. 10 MiB/s -> 83.88608 Mb/s) and the code's integer-display branch is reached with a non-integer value.

Common situations: Displaying throughput in megabits/s after converting from a MiB setting whose conversion yields a fractional number; running the command with the flag combination that routes into the double-conversion branch.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/GetStreamThroughput.java:80

                                      throughputInDouble > 0 ? throughputInDouble + " MiB/s" : "unlimited");
        }
        else if (streamThroughputDoubleMbit)
        {
            throughputInDouble = probe.getStreamThroughputAsDouble();
            probe.output().out.printf("Current stream throughput: %s%n",
                                      throughputInDouble > 0 ? throughputInDouble + " Mb/s" : "unlimited");
        }
        else
        {
            throughputInDouble = probe.getStreamThroughputAsDouble();
            throughput = probe.getStreamThroughput();

            if (throughput <= 0)
                probe.output().out.printf("Current stream throughput: unlimited%n");
            else if (DoubleMath.isMathematicalInteger(throughputInDouble))
                probe.output().out.printf("Current stream throughput: %s%n", throughput + " Mb/s");
            else
                throw new RuntimeException("Use the -d flag to quiet this error and get the exact throughput in megabits/s");
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)