apache/cassandra · error · IllegalArgumentException
does not match
Error message
{input} does not match {LEGACY} What it means
The legacy paxos contention strategy string (e.g. from paxos_contention_wait_* settings) must match the LEGACY regex (a constant or min,max[,on-failure] wait specification in time units). parseLegacy throws this IllegalArgumentException when the configured string does not conform to that grammar.
Solutions
- Correct the contention wait string to match the legacy format: a duration constant or 'min,max' range with valid time units (e.g. '1ms,10ms')
- Validate the setting with a local regex/test before deploying cassandra.yaml
- Revert to defaults by removing the custom contention setting
- Restart the node after fixing the config
Example fix
// cassandra.yaml // before paxos_contention_wait: 100 // after paxos_contention_wait: 1ms,10ms
Defensive patterns
Strategy: validation
Validate before calling
Pattern LEGACY = Pattern.compile("..."); // same grammar as ContentionStrategy.LEGACY
if (!LEGACY.matcher(cfgValue).matches()) throw new IllegalArgumentException("paxos contention wait string invalid: " + cfgValue); Try / catch
try { LegacyWait w = LegacyWait.parseLegacy(value, ...); } catch (IllegalArgumentException e) { /* fix cassandra.yaml value, e.g. '1ms,10ms' */ } Prevention
- Always include time units in duration config values (e.g. 10ms, not 10)
- Test new cassandra.yaml settings on one node before fleet rollout
- Prefer the current (non-legacy) contention config format
When it happens
Trigger: Setting paxos contention wait configuration (paxos_contention_wait_random, _min, _max style legacy strings) to a value that doesn't match the LEGACY pattern — e.g. missing units, wrong separators, or garbage like 'foo' instead of '10ms' or '1ms,10ms'.
Common situations: Typo in cassandra.yaml contention settings; using new-format syntax against a legacy parser; missing time unit (e.g. '100' instead of '100ms'); whitespace or comma/semicolon mixups.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- CasWriteTimeoutException
- CasWriteTimeoutException
- Operation timed out
- WRITE_TIMEOUT
- Can't do any consensus migrations to/from PaxosV1, switch…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/f6004974d4862c32.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/service/paxos/ContentionStrategy.java:298
private static String orElse(Supplier<String> get, String orElse)
{
String result = get.get();
return result != null ? result : orElse;
}
@VisibleForTesting
static LegacyWait parseLegacy(String spec, boolean isMin)
{
long defaultMaxMicros = getRpcTimeout(MICROSECONDS);
return parseLegacy(spec, 0, defaultMaxMicros, isMin ? 0 : defaultMaxMicros, LATENCIES);
}
public static LegacyWait parseLegacy(String input, long defaultMinMicros, long defaultMaxMicros, long onFailure, LatencySourceFactory latencies)
{
Matcher m = LEGACY.matcher(input);
if (!m.matches())
throw new IllegalArgumentException(input + " does not match " + LEGACY);
String maybeConst = m.group("const");
if (maybeConst != null)
{
long v = parseInMicros(maybeConst);
return new LegacyWait(v, v, v, new Wait.Constant(v));
}
long min = parseInMicros(m.group("min"), defaultMinMicros);
long max = parseInMicros(m.group("max"), defaultMaxMicros);
return new LegacyWait(min, max, onFailure, TimeoutStrategy.parseWait(m.group("delegate"), latencies));
}
private static class LegacyWait implements Wait
{
final long min, max, onFailure;
final Wait delegate;View on GitHub (pinned to 88fd0f6a0e)