apache/cassandra · error · IllegalArgumentException

Invalid modifier specification: '${spec.substring(next, end)

Error message

Invalid modifier specification: '${spec.substring(next, end)}'; expecting '=' for value assignment

What it means

RetryStrategy.parse processes comma-separated `key=value` modifiers in the retry/abort spec string; if a modifier segment contains no '=' (or it is positioned outside the segment), the parser rejects the fragment as an invalid modifier specification.

Source

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

    }

    public static RetryStrategy parse(String spec, LatencySourceFactory latencies)
    {
        return parse(spec, latencies, null);
    }

    public static RetryStrategy parse(String spec, LatencySourceFactory latencies, WaitRandomizer randomizer)
    {
        String original = spec;
        int retries = Integer.MAX_VALUE;
        int end = spec.length();
        {
            int next;
            while ((next = spec.lastIndexOf(',', end - 1)) >= 0)
            {
                int mid = spec.indexOf('=', next + 1);
                if (mid <= next || mid >= end)
                    throw new IllegalArgumentException("Invalid modifier specification: '" + spec.substring(next, end) + "'; expecting '=' for value assignment");
                String key = spec.substring(next + 1, mid).trim();
                String value = spec.substring(mid + 1, end).trim();
                switch (key)
                {
                    default: throw new IllegalArgumentException("Invalid modifier specification: unrecognised property '" + key + '\'');
                    case "retries":
                        retries = Integer.parseInt(value);
                        if (retries < 0)
                            throw new IllegalArgumentException("retries must be non-negative (retries=" + value + " supplied)");
                        break;
                    case "attempts":
                        retries = Integer.parseInt(value);
                        if (retries < 0)
                            throw new IllegalArgumentException("Must permit at least one attempt (attempts=" + value + " supplied)");
                        break;
                    case "rnd":
                        if (randomizer != null)
                            throw new IllegalArgumentException("Randomizer already specified, cannot re-specify: " + value);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Ensure every modifier is `key=value` (e.g. `retries=3`), comma-separated, inside the strategy spec
  2. Check spelling of supported keys (retries, ...) per RetryStrategy's parser
  3. Quote the spec in config files so spaces/commas are not mangled

Example fix

// before
retry(3,retries)
// after
retry(3,retries=5)
Defensive patterns

Strategy: validation

Validate before calling

// validate each modifier segment has key=value before parsing
for (String seg : spec.split(","))
    if (!seg.contains("="))
        throw new IllegalArgumentException("modifier missing '=': " + seg);

Try / catch

try { RetryStrategy.parse(spec); } catch (IllegalArgumentException e) { if (e.getMessage().contains("expecting '=' for value assignment")) RetryStrategy.parse(fixSpec(spec)); else throw e; }

Prevention

When it happens

Trigger: Passing a spec like `retry(3,mkdir)` or `retry(3,retries)` where a modifier lacks `key=value` form; malformed spacing or a missing value after '='.

Common situations: Hand-editing a retry strategy spec string in configuration (e.g. `max_retries=3,millis_between=100` typo'd); copy-paste dropping the '=value' part; using an unrecognized property name which triggers the adjacent 'unrecognised property' error.

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/f00d48daee0e813e. Report an issue: GitHub.