apache/cassandra · error · ConfigurationException

Invalid value for option

Error message

Invalid value %s for option '%s'

What it means

FixedSpeculativeRetryPolicy.fromString parses the SPECULATIVE_RETRY table option's fixed-millisecond forms (e.g. '50ms'). On failure it throws ConfigurationException 'Invalid value %s for option 'speculative_retry''.

Solutions

  1. Use the accepted format: a number followed by 'ms', e.g. SPECULATIVE_RETRY = '50ms'
  2. Query system_schema.tables for the current valid value as a reference
  3. For percentage-style behavior use the PERCENTILE form (e.g. '99PERCENTILE') handled by a different policy
  4. Validate the value in tooling before issuing schema changes

Example fix

// before
ALTER TABLE ks.tbl WITH speculative_retry = '50';
// after
ALTER TABLE ks.tbl WITH speculative_retry = '50ms';
Defensive patterns

Strategy: validation

Validate before calling

// client-side validation before ALTER TABLE
Pattern p = Pattern.compile("\\d+ms");
if (!p.matcher(speculativeRetry).matches()) throw new IllegalArgumentException("use e.g. '50ms'");

Try / catch

try { session.execute(alter); } catch (com.datastax.driver.core.exceptions.InvalidQueryException e) { if (e.getMessage().contains("speculative_retry")) fixAndRetry(); else throw e; }

Prevention

When it happens

Trigger: CREATE/ALTER TABLE with SPECULATIVE_RETRY set to an unparseable value like '50' (missing ms), '50milliseconds', or other text not matching the pattern.

Common situations: Copy-pasting option values from older documentation or other systems, typos, and scripts generated with wrong units.

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


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

Appendix: source

Thrown at src/java/org/apache/cassandra/service/reads/FixedSpeculativeRetryPolicy.java:89

        return String.format("%dms", speculateAtMilliseconds);
    }

    static FixedSpeculativeRetryPolicy fromString(String str)
    {
        Matcher matcher = PATTERN.matcher(str);

        if (!matcher.matches())
            throw new IllegalArgumentException();

        String val = matcher.group("val");
        try
        {
             // historically we've always parsed this as double, but treated as int; so we keep doing it for compatibility
            return new FixedSpeculativeRetryPolicy((int) Double.parseDouble(val));
        }
        catch (IllegalArgumentException e)
        {
            throw new ConfigurationException(String.format("Invalid value %s for option '%s'", str, TableParams.Option.SPECULATIVE_RETRY));
        }
    }

    static boolean stringMatches(String str)
    {
        return PATTERN.matcher(str).matches();
    }
}

View on GitHub (pinned to 88fd0f6a0e)