apache/cassandra · error · IllegalArgumentException
Unable to parse token range from ; format is left,right but…
Error message
Unable to parse token range from ; format is left,right but saw parts
What it means
StandaloneVerifier's offline verification tool accepts a --token-range CLI argument that must be two comma-separated longs forming a token range. parseTokenRange splits on ',' and throws IllegalArgumentException when the split does not yield exactly 2 parts, i.e. the user supplied zero, one, or more-than-two comma-separated values.
Solutions
- Pass exactly two comma-separated long tokens, e.g. --token-range 123456789,987654321
- Quote the argument in the shell so commas/spaces survive, e.g. --token-range "123,456"
- Inspect the input for stray spaces or extra commas (split(',') counts empty parts); trim before passing
Example fix
// before --token-range 123:456 // after --token-range 123,456
Defensive patterns
Strategy: validation
Validate before calling
String[] parts = tokenRange.split(",");
if (parts.length != 2)
throw new IllegalArgumentException("--token-range must be 'left,right', got: " + tokenRange);
Long.parseLong(parts[0].trim());
Long.parseLong(parts[1].trim()); Prevention
- Always pass exactly two comma-separated longs
- Quote range arguments in the shell
- Trim whitespace before splitting
When it happens
Trigger: Running standalone_verifier (or calling StandaloneVerifier.parseTokenRange) with a --token-range argument like '123', '1,2,3', an empty string, or one containing spaces/newlines that split into != 2 parts.
Common situations: Hand-typing a range with a semicolon or space instead of a comma; copying a range rendered as 'left:right'; accidentally passing multiple ranges 'a,b c,d'; shell stripping the trailing value leaving '123,'.
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.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- All sstables must be part of the same keyspace
- All sstables must be part of the same table
- Either --sstables or --journal-segments must be provided
- error
- Illegal distribution specification:
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/4ad5ad3accec47fe.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/tools/StandaloneVerifier.java:309
header.append("--\n");
header.append("Verify the sstable for the provided table." );
header.append("\n--\n");
header.append("NOTE: There are significant risks associated with using this tool; it likely doesn't do what " +
"you expect and there are known edge cases. You must provide a -f or --force argument in " +
"order to allow usage of the tool -> see CASSANDRA-9947 and CASSANDRA-17017 for known risks.\n");
header.append("https://issues.apache.org/jira/browse/CASSANDRA-9947\n");
header.append("https://issues.apache.org/jira/browse/CASSANDRA-17017");
header.append("\n--\n");
header.append("Options are:");
new HelpFormatter().printHelp(usage, header.toString(), options, "");
}
}
private static Range<Token> parseTokenRange(String line)
{
String[] split = line.split(",");
if (split.length != 2)
throw new IllegalArgumentException("Unable to parse token range from " + line + "; format is left,right but saw " + split.length + " parts");
long left = Long.parseLong(split[0]);
long right = Long.parseLong(split[1]);
return new Range<>(new Murmur3Partitioner.LongToken(left), new Murmur3Partitioner.LongToken(right));
}
}
View on GitHub (pinned to 88fd0f6a0e)