apache/cassandra · error · IllegalArgumentException

does not match

Error message

${input} does not match${RANDOMIZER}

What it means

parseWaitRandomizer validates the rnd value against the RANDOMIZER regex, which accepts forms like 'uniform', 'exp(<factor>)', and 'qexp(<factor>)'. Unrecognised input throws an IllegalArgumentException showing the input and the expected pattern.

Solutions

  1. Use one of the accepted forms: uniform, exp(<factor>), or qexp(<factor>) — e.g. rnd=exp(2)
  2. Omit the rnd modifier entirely to get the default uniform randomizer
  3. Compare your input against the RANDOMIZER pattern printed in the exception message

Example fix

// before
RetryStrategy.parse("100ms..1s,rnd=exponential(2)", latencies);
// after
RetryStrategy.parse("100ms..1s,rnd=exp(2)", latencies);
Defensive patterns

Strategy: validation

Validate before calling

private static final Pattern RND_PATTERN = Pattern.compile("uniform|exp\\(\\d+(\\.\\d+)?\\)|qexp\\(\\d+(\\.\\d+)?\\)");
static void validateRndValue(String value) {
    if (!RND_PATTERN.matcher(value.trim()).matches())
        throw new IllegalArgumentException("rnd value '" + value + "' must be uniform, exp(<f>), or qexp(<f>)");
}

Try / catch

try {
    RetryStrategy strategy = RetryStrategy.parse(spec, latencies);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("does not match")) {
        throw new ConfigurationException("Invalid rnd value in '" + spec + "'; use uniform, exp(<factor>) or qexp(<factor>)");
    }
    throw e;
}

Prevention

When it happens

Trigger: A ',rnd=<value>' modifier whose value is not a valid randomizer form, e.g. "100ms..1s,rnd=random" or "100ms..1s,rnd=exponential(2)" (spelled out instead of 'exp').

Common situations: Typos in randomizer names; using long names ('exponential', 'quantized') instead of the accepted 'exp'/'qexp' abbreviations; configs ported from systems with different randomizer vocabularies.

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


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/c119391ab9dd3679. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/service/RetryStrategy.java:331

            throw new IllegalArgumentException("Invalid to specify randomiser when no range specified: '" + original + '\'');
        if (min instanceof Wait.Constant && minMin != 0)
            throw new IllegalArgumentException("Invalid to specify an absolute minimum constant when the min bound is itself a constant: '" + original + '\'');
        long maxMin = parseInMicros(m.group("maxmin"), Long.MAX_VALUE);
        if (min instanceof Wait.Constant && maxMin != Long.MAX_VALUE)
            throw new IllegalArgumentException("Invalid to specify an absolute max(min) constant when the min bound is itself a constant: '" + original + '\'');
        if (max instanceof Wait.Constant && maxMax != Long.MAX_VALUE)
            throw new IllegalArgumentException("Invalid to specify an absolute maximum constant when the max bound is itself a constant: '" + original + '\'');
        if (randomizer == null)
            randomizer = randomizers.uniform();
        return new RetryStrategy(randomizer, minMin, min, maxMin, max, maxMax, retries);
    }

    @VisibleForTesting
    protected static WaitRandomizer parseWaitRandomizer(String input)
    {
        Matcher m = RANDOMIZER.matcher(input);
        if (!m.matches())
            throw new IllegalArgumentException(input + " does not match" + RANDOMIZER);

        String exp;
        exp = m.group("exp");
        if (exp != null)
            return randomizers.exponential(Double.parseDouble(exp));
        exp = m.group("qexp");
        if (exp != null)
            return randomizers.quantizedExponential(Double.parseDouble(exp));
        return randomizers.uniform();
    }
}

View on GitHub (pinned to 88fd0f6a0e)