apache/cassandra · error · IllegalArgumentException
is defined multiple times. Each option/command can be…
Error message
is defined multiple times. Each option/command can be specified at most once.
What it means
The stress CLI parses arguments into a map keyed by option/command name; putParam throws IllegalArgumentException when the same key is seen a second time, since each option or command may be specified at most once on the command line.
Solutions
- Remove duplicate occurrences of the named option from the command line
- Combine values into a single occurrence where the option accepts lists, e.g. -node ip1,ip2 or -log interval=10s level=debug
- Fix the script that builds the arguments to deduplicate flags
Example fix
// before -node 127.0.0.1 -node 127.0.0.2 // after -node 127.0.0.1,127.0.0.2
Defensive patterns
Strategy: validation
Validate before calling
Map<String,Integer> seen = new HashMap<>();
for (String a : args) if (a.startsWith("-")) {
int n = seen.merge(a, 1, Integer::sum);
if (n > 1) throw new IllegalArgumentException(a + " repeated");
} Try / catch
try { StressSettings.get(parseMap(rawArgs)); } catch (IllegalArgumentException e) { if (e.getMessage().endsWith("defined multiple times")) { dedupe(rawArgs); retry(); } else throw e; } Prevention
- Deduplicate flags when assembling command lines from multiple config sources
- Use list syntax (-node ip1,ip2) instead of repeating an option
- Log the final assembled command line before execution to catch accidental duplicates
When it happens
Trigger: Repeating any option or command, e.g. 'cassandra-stress write -log interval=10s -log level=debug' or '-node a -node b' — the second occurrence triggers the error naming the duplicated key.
Common situations: Concatenating option strings from multiple config sources in scripts, shell loops appending the same flag per item instead of comma-joining values.
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
- can't have both fixed and throttle set, choose one.
- Log interval must be greater than zero
- -schema can only be provided with predefined operations…
- Suboption has been specified more than once
- A repair_session_space of
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/0e3c4ab5f921dcfe.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java:269
if (i == 0 || args[i].startsWith("-"))
{
if (i > 0)
putParam(key, params.toArray(new String[0]), r);
key = toLowerCaseLocalized(args[i]);
params.clear();
}
else
params.add(args[i]);
}
putParam(key, params.toArray(new String[0]), r);
return r;
}
private static void putParam(String key, String[] args, Map<String, String[]> clArgs)
{
String[] prev = clArgs.put(key, args);
if (prev != null)
throw new IllegalArgumentException(key + " is defined multiple times. Each option/command can be specified at most once.");
}
public static void printHelp()
{
SettingsMisc.printHelp();
}
public void printSettings(ResultLogger out)
{
out.println("******************** Stress Settings ********************");
// done
out.println("Command:");
command.printSettings(out);
out.println("Rate:");
rate.printSettings(out);
out.println("Population:");
generate.printSettings(out);
out.println("Insert:");View on GitHub (pinned to 88fd0f6a0e)