apache/cassandra · error · ConfigurationException

Invalid value for option

Error message

Invalid value %s for option '%s'

What it means

Fallback thrown by SpeculativeRetryPolicy.fromString when the speculative_retry string matches none of the known policy forms: NONE, ALWAYS, a fixed time ('XXms'), a percentile ('XXp'/'XXPERCENTILE'), or a MIN/MAX hybrid. It means the option value's syntax is simply unrecognized.

Solutions

  1. Use one of the accepted forms: NONE, ALWAYS, '50ms', '99p' (or '99PERCENTILE'), 'MIN(50ms, 99p)'
  2. Strip whitespace and verify the unit suffix is exactly 'ms' for fixed values
  3. Re-run DESCRIBE TABLE to copy the exact current value format as a template

Example fix

// before
ALTER TABLE ks.tbl WITH speculative_retry = '99PERCENT';
// after
ALTER TABLE ks.tbl WITH speculative_retry = '99PERCENTILE';
Defensive patterns

Strategy: validation

Validate before calling

const SPECULATIVE_RETRY_RE = /^(NONE|ALWAYS|[0-9]*\.?[0-9]+ms|[0-9]*\.?[0-9]+p|[0-9]*\.?[0-9]+PERCENTILE|(MIN|MAX)\([^)]+,[^)]+\))$/i;
function validateSpeculativeRetry(v) { if (!SPECULATIVE_RETRY_RE.test(v.trim())) throw new Error(`unrecognized speculative_retry: ${v}`); }

Prevention

When it happens

Trigger: speculative_retry set to a misspelled or legacy value such as '99percentile' (lowercase, no p), '500' without a unit, 'min(10ms,99p)' inside wrong quotes, or empty string via TableParams from a config/CQL statement.

Common situations: Upgrading from very old Cassandra versions where only 'milliseconds' or 'percentile' spellings existed; hand-edited schema files; driver-generated ALTER statements with locale-formatted numbers (e.g. '99,9p').

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/service/reads/SpeculativeRetryPolicy.java:59

    public static SpeculativeRetryPolicy fromString(String str)
    {
        if (AlwaysSpeculativeRetryPolicy.stringMatches(str))
            return AlwaysSpeculativeRetryPolicy.INSTANCE;

        if (NeverSpeculativeRetryPolicy.stringMatches(str))
            return NeverSpeculativeRetryPolicy.INSTANCE;

        if (PercentileSpeculativeRetryPolicy.stringMatches(str))
            return PercentileSpeculativeRetryPolicy.fromString(str);

        if (FixedSpeculativeRetryPolicy.stringMatches(str))
            return FixedSpeculativeRetryPolicy.fromString(str);

        if (HybridSpeculativeRetryPolicy.stringMatches(str))
            return HybridSpeculativeRetryPolicy.fromString(str);

        throw new ConfigurationException(String.format("Invalid value %s for option '%s'", str, TableParams.Option.SPECULATIVE_RETRY));
    }
}

View on GitHub (pinned to 88fd0f6a0e)