apache/cassandra · error · IllegalArgumentException
Invalid specification:
Error message
Invalid specification:
What it means
OptionMulti parses a compound spec (like a compound 'key=value,rate' list, e.g. 'read=1,write=2') with a regex and requires the tokens to be contiguous matches. When a token starts at a position other than lastEnd+1, the whole parameter is malformed (stray characters between comma-separated parts), producing 'Invalid <name> specification: <param>'.
Solutions
- Remove stray characters so tokens are contiguous and comma-separated: read=1,write=2
- Quote the whole spec for the shell and avoid internal spaces
- Test the spec string against the expected '<name>=<value>[,...]' pattern before invoking.
Example fix
// before -read=1,,write=2 // after -read=1,write=2
Defensive patterns
Strategy: validation
Validate before calling
boolean wellFormed(String spec){ return spec.matches("([A-Za-z_]+=\\d+)(,[A-Za-z_]+=\\d+)*"); } // contiguous, comma-separated key=value Try / catch
try { opt.accept(spec); } catch (IllegalArgumentException e) { log.error("Malformed compound spec '{}'", spec); } Prevention
- Regex-check the full spec before invoking stress
- Avoid spaces and stray separators inside compound specs
- Build specs programmatically with join(',', pairs) rather than string concatenation
When it happens
Trigger: A spec string with stray/unrecognized characters between recognized tokens, e.g. 'read=1,,write=2' or 'read=1; write=2', so the matcher finds a gap.
Common situations: Double commas from template substitution; using ';' instead of ','; spaces inside the spec that the regex treats as noise; copied specs with invisible characters.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- arguments for -F are json, yaml, table only.
- Cannot specify tokens without keyspace.
- Invalid parameter list for fixed distribution:
- Invalid parameter list for sequence distribution:
- Invalid parameter list for sequence distribution…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/ce528daa5dec8f40.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/stress/settings/OptionMulti.java:87
{
this.name = name;
pattern = Pattern.compile(name + "\\((.*)\\)", Pattern.CASE_INSENSITIVE);
this.description = description;
this.collectAsMap = collectExtraOptionsInMap ? new CollectAsMap() : null;
}
@Override
public boolean accept(String param)
{
Matcher m = pattern.matcher(param);
if (!m.matches())
return false;
m = ARGS.matcher(m.group(1));
int last = -1;
while (m.find())
{
if (m.start() != last + 1)
throw new IllegalArgumentException("Invalid " + name + " specification: " + param);
last = m.end();
if (!delegate.accept(m.group()))
{
throw new IllegalArgumentException("Invalid " + name + " specification: " + m.group());
}
}
return true;
}
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append(name);
sb.append("(");
for (Option option : delegate.options())
{
sb.append(option);View on GitHub (pinned to 88fd0f6a0e)