{"record":{"id":"dee372e9d65b0ead","repo":"apache/cassandra","slug":"invalid-value-s-for-percentile-option-s-must","errorCode":null,"errorMessage":"Invalid value %s for PERCENTILE option '%s': must be between (0.0 and 100.0)","messagePattern":"Invalid value (.+?) for PERCENTILE option '(.+?)': must be between \\(0\\.0 and 100\\.0\\)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java","lineNumber":112,"sourceCode":"\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":94,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/reads/PercentileSpeculativeRetryPolicy.java#L94-L124","documentation":"Thrown by PercentileSpeculativeRetryPolicy.fromString when the parsed percentile is <= 0.0 or >= 100.0. A percentile of exactly 0 or 100 is rejected because speculative retries at those bounds are meaningless (0 = never, 100 = always) and the policy requires an open-interval value.","triggerScenarios":"speculative_retry set to '0p', '100p', '0.0PERCENTILE', '100.0PERCENTILE', or a negative value like '-5p' in CREATE/ALTER TABLE.","commonSituations":"Users trying to disable retries with '0p' (use NONE instead); trying '100p' to 'always retry'; templated configs where 100 means percent-complete rather than percentile.","solutions":["Pick a value strictly between 0 and 100, e.g. '99p' or '50p'","Use speculative_retry = 'NONE' to disable speculative retries entirely","Use 'ALWAYS' if you truly want a retry on every read"],"exampleFix":"// before\nALTER TABLE ks.tbl WITH speculative_retry = '100p';\n// after\nALTER TABLE ks.tbl WITH speculative_retry = '99p';","handlingStrategy":"validation","validationCode":"function checkPercentileRange(v) {\n  const m = /^([0-9]*\\.?[0-9]+)(p|PERCENTILE)$/i.exec(v.trim());\n  if (!m) return false;\n  const n = parseFloat(m[1]);\n  if (n <= 0.0 || n >= 100.0) throw new RangeError(`percentile ${n} must be between (0.0 and 100.0)`);\n  return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reject 0p/100p in config generation; map them to NONE/ALWAYS explicitly","Clamp generated percentiles to [0.1, 99.9]","Document in runbooks that bounds are exclusive"],"tags":["configuration","cql","speculative-retry","range"],"backgroundTag":"value-out-of-range","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"}