{"record":{"id":"cf26837614006ab5","repo":"apache/cassandra","slug":"invalid-value-s-for-option-s-cf2683","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/HybridSpeculativeRetryPolicy.java","lineNumber":120,"sourceCode":"    static HybridSpeculativeRetryPolicy fromString(String str)\n    {\n        Matcher matcher = PATTERN.matcher(str);\n\n        if (!matcher.matches())\n            throw new IllegalArgumentException();\n\n        String val1 = matcher.group(\"val1\");\n        String val2 = matcher.group(\"val2\");\n\n        SpeculativeRetryPolicy value1, value2;\n        try\n        {\n            value1 = SpeculativeRetryPolicy.fromString(val1);\n            value2 = SpeculativeRetryPolicy.fromString(val2);\n        }\n        catch (ConfigurationException e)\n        {\n            throw new ConfigurationException(String.format(\"Invalid value %s for option '%s'\", str, TableParams.Option.SPECULATIVE_RETRY));\n        }\n\n        if (value1.kind() == value2.kind())\n        {\n            throw new ConfigurationException(String.format(\"Invalid value %s for option '%s': MIN()/MAX() arguments \" +\n                                                           \"should be of different types, but both are of type %s\",\n                                                           str, TableParams.Option.SPECULATIVE_RETRY, value1.kind()));\n        }\n\n        SpeculativeRetryPolicy policy1 = value1 instanceof PercentileSpeculativeRetryPolicy ? value1 : value2;\n        SpeculativeRetryPolicy policy2 = value1 instanceof FixedSpeculativeRetryPolicy ? value1 : value2;\n\n        Function function = Function.valueOf(toUpperCaseLocalized(matcher.group(\"fun\")));\n        return new HybridSpeculativeRetryPolicy((PercentileSpeculativeRetryPolicy) policy1, (FixedSpeculativeRetryPolicy) policy2, function);\n    }\n\n    static boolean stringMatches(String str)\n    {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/reads/HybridSpeculativeRetryPolicy.java#L102-L138","documentation":"HybridSpeculativeRetryPolicy.fromString parses MIN(x, y)/MAX(x, y) forms of SPECULATIVE_RETRY. It throws ConfigurationException 'Invalid value %s for option 'speculative_retry'' when either inner value fails to parse, and additionally when both arguments are of the same kind (e.g. MIN(50ms, 80ms) or MIN(99PERCENTILE, 95PERCENTILE)).","triggerScenarios":"SPECULATIVE_RETRY = 'MIN(50ms, 80ms)' (both fixed), 'MAX(99PERCENTILE, 95PERCENTILE)' (both percentile), or unparseable inner values like 'MIN(50ms, bogus)'.","commonSituations":"Assuming same-type arguments are allowed, mixing up syntax from other databases, or typos inside the parentheses.","solutions":["Use one fixed (ms) and one percentile argument, e.g. SPECULATIVE_RETRY = 'MIN(50ms, 99PERCENTILE)'","Match the exact casing/spacing the pattern accepts: MIN(...)/MAX(...) with valid inner policies","Simplify to a single fixed '50ms' or percentile '99PERCENTILE' policy if a hybrid isn't needed","Check server logs/docs for the supported grammar of speculative_retry in your version"],"exampleFix":"// before\nALTER TABLE ks.tbl WITH speculative_retry = 'MIN(50ms, 80ms)';\n// after\nALTER TABLE ks.tbl WITH speculative_retry = 'MIN(50ms, 99PERCENTILE)';","handlingStrategy":"validation","validationCode":"// validate hybrid speculative_retry syntax and argument kinds\nPattern p = Pattern.compile(\"(MIN|MAX)\\\\((\\\\d+ms|\\\\d+PERCENTILE),\\\\s*(\\\\d+ms|\\\\d+PERCENTILE)\\\\)\");\nMatcher m = p.matcher(value);\nif (!m.matches() || m.group(2).equals(m.group(3))) throw new IllegalArgumentException(\"need one ms + one PERCENTILE arg\");","typeGuard":null,"tryCatchPattern":"try { session.execute(alter); } catch (com.datastax.driver.core.exceptions.InvalidQueryException e) { if (e.getMessage().contains(\"speculative_retry\")) sanitizeAndRetry(); else throw e; }","preventionTips":["Always pair one fixed (ms) argument with one percentile argument in MIN()/MAX()","Copy exact syntax from docs for your Cassandra version","Centralize table-option generation in one validated helper","Verify with DESC TABLE after applying schema changes"],"tags":["cql","schema","config"],"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"}