apache/cassandra · error · ConfigurationException

Invalid value for option

Error message

Invalid value %s for option '%s'

What it means

Thrown by PercentileSpeculativeRetryPolicy.fromString when the numeric portion of a percentile speculative_retry value cannot be parsed as a double, or (second branch of the same method) falls outside the open interval (0.0, 100.0). This policy drives speculative retries at a percentile of read latency.

Solutions

  1. Use a valid percentile between 0 and 100 exclusive, e.g. '99p' or '99.9PERCENTILE'
  2. Check that only the trailing 'p'/'PERCENTILE' suffix is present and the leading text is a plain decimal number
  3. If a time bound was intended, use fixed syntax like '50ms' instead of percentile syntax

Example fix

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

Strategy: validation

Validate before calling

function isValidPercentileRetry(v) {
  const m = /^([0-9]*\.?[0-9]+)p$|^([0-9]*\.?[0-9]+)PERCENTILE$/i.exec(v.trim());
  if (!m) return false;
  const n = parseFloat(m[1] || m[2]);
  return n > 0.0 && n < 100.0 && Number.isFinite(n);
}

Prevention

When it happens

Trigger: Setting speculative_retry to a PERCENTILE value like '99p'/'99PERCENTILE' where the number is malformed (e.g. 'abc p', 'p99') or non-finite (NaN/Infinity, which fail the range check since comparisons with NaN are false and Double.parseDouble('NaN') yields NaN caught by range check).

Common situations: Typos in CQL schema statements; scripts templating values wrongly ('%sp' producing '99.0p' is fine, but ''p' or '99pp' is not); porting configs between Cassandra versions with different accepted syntaxes.

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

Appendix: source

Thrown at src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java:107

    }

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

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

        String val = matcher.group("val");

        double percentile;
        try
        {
            percentile = Double.parseDouble(val);
        }
        catch (IllegalArgumentException e)
        {
            throw new ConfigurationException(String.format("Invalid value %s for option '%s'", str, TableParams.Option.SPECULATIVE_RETRY));
        }

        if (percentile <= 0.0 || percentile >= 100.0)
        {
            throw new ConfigurationException(String.format("Invalid value %s for PERCENTILE option '%s': must be between (0.0 and 100.0)",
                                                           str, TableParams.Option.SPECULATIVE_RETRY));
        }

        return new PercentileSpeculativeRetryPolicy(percentile);
    }

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

View on GitHub (pinned to 88fd0f6a0e)