{"record":{"id":"71904c3669018d82","repo":"apache/cassandra","slug":"invalid-value-s-for-option-s-71904c","errorCode":null,"errorMessage":"Invalid value %s for option '%s'","messagePattern":"Invalid value (.+?) for option '(.+?)'","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java","lineNumber":107,"sourceCode":"    }\n\n    static PercentileSpeculativeRetryPolicy fromString(String str)\n    {\n        Matcher matcher = PATTERN.matcher(str);\n\n        if (!matcher.matches())\n            throw new IllegalArgumentException();\n\n        String val = matcher.group(\"val\");\n\n        double percentile;\n        try\n        {\n            percentile = Double.parseDouble(val);\n        }\n        catch (IllegalArgumentException e)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value %s for option '%s'\", str, TableParams.Option.SPECULATIVE_RETRY));\n        }\n\n        if (percentile <= 0.0 || percentile >= 100.0)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value %s for PERCENTILE option '%s': must be between (0.0 and 100.0)\",\n                                                           str, TableParams.Option.SPECULATIVE_RETRY));\n        }\n\n        return new PercentileSpeculativeRetryPolicy(percentile);\n    }\n\n    static boolean stringMatches(String str)\n    {\n        return PATTERN.matcher(str).matches();\n    }\n}\n","sourceCodeStart":89,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java#L89-L124","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use a valid percentile between 0 and 100 exclusive, e.g. '99p' or '99.9PERCENTILE'","Check that only the trailing 'p'/'PERCENTILE' suffix is present and the leading text is a plain decimal number","If a time bound was intended, use fixed syntax like '50ms' instead of percentile syntax"],"exampleFix":"// before\nALTER TABLE ks.tbl WITH speculative_retry = '99PERCENTILEs';\n// after\nALTER TABLE ks.tbl WITH speculative_retry = '99PERCENTILE';","handlingStrategy":"validation","validationCode":"function isValidPercentileRetry(v) {\n  const m = /^([0-9]*\\.?[0-9]+)p$|^([0-9]*\\.?[0-9]+)PERCENTILE$/i.exec(v.trim());\n  if (!m) return false;\n  const n = parseFloat(m[1] || m[2]);\n  return n > 0.0 && n < 100.0 && Number.isFinite(n);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep percentiles in the open interval (0,100); use NONE instead of 0p","Standardize on the '99p' short form in schema scripts","Unit-test schema templates that interpolate percentile values"],"tags":["configuration","cql","speculative-retry","parsing"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}