apache/cassandra · error · IllegalArgumentException
can't have both fixed and throttle set, choose one.
Error message
can't have both fixed and throttle set, choose one.
What it means
SettingsRate lets you limit throughput either with -rate throttle=<N>/s (dynamic rate limiting) or -rate fixed=<N>/s (fixed rate), but not both. The constructor throws IllegalArgumentException when both parse to non-zero values because the two modes are mutually exclusive.
Solutions
- Keep only one of throttle= or fixed= in the -rate option
- If you want a strict fixed rate, drop throttle=; if you want adaptive throttling, drop fixed=
- threads= can be combined with either one, so keep threads and one rate knob
Example fix
// before -rate threads=10 throttle=5000/s fixed=3000/s // after -rate threads=10 throttle=5000/s
Defensive patterns
Strategy: validation
Validate before calling
boolean hasThrottle = cmdLine.matches(".*-rate[^-]*throttle=[^0]");
boolean hasFixed = cmdLine.matches(".*-rate[^-]*fixed=[^0]");
if (hasThrottle && hasFixed) throw new IllegalArgumentException("choose either throttle or fixed"); Try / catch
try { SettingsRate.get(clArgs, cmd); } catch (IllegalArgumentException e) { if (e.getMessage().contains("both fixed and throttle")) stripOption(args, "fixed"); else throw e; } Prevention
- Pick one throughput knob per run: throttle OR fixed
- When templating commands, strip rate fragments before appending new ones
- Comment out rather than zero-out competing options in config templates
When it happens
Trigger: cassandra-stress ... -rate threads=10 throttle=5000/s fixed=3000/s — both throttle and fixed options supplied with non-zero values.
Common situations: Merging rate settings from two script fragments, or a template command that already contains fixed= while the operator appends throttle=.
Related errors
- Do not specify additional arguments when --category/-c is…
- is defined multiple times. Each option/command can be…
- Log interval must be greater than zero
- -schema can only be provided with predefined operations…
- You cannot use -e and -m at the same time
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/774b3d0427ba07aa.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/stress/settings/SettingsRate.java:50
{
public final boolean auto;
public final int minThreads;
public final int maxThreads;
public final int threadCount;
public final int opsPerSecond;
public final boolean isFixed;
public SettingsRate(ThreadOptions options)
{
auto = false;
threadCount = Integer.parseInt(options.threads.value());
String throttleOpt = options.throttle.value();
String fixedOpt = options.fixed.value();
int throttle = Integer.parseInt(throttleOpt.substring(0, throttleOpt.length() - 2));
int fixed = Integer.parseInt(fixedOpt.substring(0, fixedOpt.length() - 2));
if(throttle != 0 && fixed != 0)
throw new IllegalArgumentException("can't have both fixed and throttle set, choose one.");
opsPerSecond = Math.max(fixed, throttle);
isFixed = (opsPerSecond == fixed);
minThreads = -1;
maxThreads = -1;
}
public SettingsRate(AutoOptions auto)
{
this.auto = auto.auto.setByUser();
this.minThreads = Integer.parseInt(auto.minThreads.value());
this.maxThreads = Integer.parseInt(auto.maxThreads.value());
this.threadCount = -1;
this.opsPerSecond = 0;
isFixed = false;
}
View on GitHub (pinned to 88fd0f6a0e)