apache/cassandra · error · IllegalArgumentException
Suboption has been specified more than once
Error message
Suboption has been specified more than once
What it means
OptionSimple represents a single-valued CLI option; it stores the parsed value in a field and throws if accept() is called again while a value is already set. This guards against specifying the same suboption twice on the command line, which would make the effective value ambiguous.
Solutions
- Remove the duplicate flag so each suboption appears at most once per invocation.
- If you intended to override, delete the earlier occurrence rather than adding a second one.
- Audit wrapper scripts for flags appended by both a defaults block and a user block.
- If you control the option-group code, check/deduplicate the argument list before feeding it to accept().
Example fix
// before cassandra-stress write n=1000000 -col n=5 n=10 // after cassandra-stress write n=1000000 -col n=10
Defensive patterns
Strategy: validation
Validate before calling
Set<String> seen = new HashSet<>();
for (String arg : args) { String key = arg.contains("=") ? arg.substring(0, arg.indexOf('=')) : arg; if (!seen.add(key)) throw new IllegalArgumentException("duplicate option: " + key); } Try / catch
try { /* parse args */ } catch (IllegalArgumentException e) { if (e.getMessage().contains("specified more than once")) { /* log which flag is duplicated */ } throw e; } Prevention
- Keep a single source of truth for option values in wrapper scripts.
- Grep generated command lines for repeated '-key=' prefixes before executing.
- Override by replacing, not appending.
When it happens
Trigger: Passing the same option flag twice in one cassandra-stress invocation, e.g. '-col n=5 n=10' or specifying an option both in a settings string and again on the command line, so accept(param) runs a second time with value != null.
Common situations: Scripting the stress command and accidentally appending a duplicate flag (a default plus an override); a wrapper concatenating two option lists that both set the same key; copy-pasting a flag inside the same -col/-rate group.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- CAS is supported only for type 'samerow'
- File '' doesn't exist!
- Invalid compaction strategy:
- Invalid default spec:
- Invalid lookback distribution; max value is
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/c601a30210c31db8.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/stress/settings/OptionSimple.java:111
return required;
}
public boolean present()
{
return value != null || defaultValue != null;
}
public String value()
{
return value != null ? value : defaultValue;
}
public boolean accept(String param)
{
if (matchPrefix.matcher(param).lookingAt())
{
if (value != null)
throw new IllegalArgumentException("Suboption " + displayPrefix + " has been specified more than once");
String v = param.substring(displayPrefix.length());
value = valueAdapter.apply(v);
assert value != null;
return true;
}
return false;
}
@Override
public boolean happy()
{
return !required || value != null;
}
public String shortDisplay()
{
StringBuilder sb = new StringBuilder();
if (!required)View on GitHub (pinned to 88fd0f6a0e)