{"record":{"id":"4ef8091c1e7df406","repo":"apache/cassandra","slug":"invalid-value-s-for-option-s-min-max-argu","errorCode":null,"errorMessage":"Invalid value %s for option '%s': MIN()/MAX() arguments should be of different types, but both are of type %s","messagePattern":"Invalid value (.+?) for option '(.+?)': MIN\\(\\)/MAX\\(\\) arguments should be of different types, but both are of type (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/reads/HybridSpeculativeRetryPolicy.java","lineNumber":125,"sourceCode":"            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    {\n        return PATTERN.matcher(str).matches();\n    }\n}\n","sourceCodeStart":107,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/reads/HybridSpeculativeRetryPolicy.java#L107-L142","documentation":"Thrown by HybridSpeculativeRetryPolicy.fromString when parsing a MIN()/MAX() speculative_retry value whose two arguments are the same kind (e.g. MIN(50ms, 60ms) — both fixed, or MIN(50p, 99p) — both percentile). MIN/MAX hybrids require one fixed and one percentile argument so the policy can pick between a time bound and a percentile bound.","triggerScenarios":"Setting speculative_retry to MIN(x,y) or MAX(x,y) via CREATE/ALTER TABLE or TableParams where both x and y parse to the same kind: both milliseconds/fixed values or both percentile values (e.g. 'MIN(10ms, 99p)' is valid but 'MIN(10ms, 20ms)' is not).","commonSituations":"Copy-pasting speculative_retry settings from old configs or docs; misunderstanding that MIN/MAX compare one time bound and one percentile; typos like 'MIN(50p, 99PERCENTILE)' where both parse as percentiles.","solutions":["Change the MIN()/MAX() arguments so one is a fixed time (e.g. 50ms) and the other a percentile (e.g. 99p)","If only one bound is needed, drop the hybrid entirely and set speculative_retry to the plain value (e.g. '50ms' or '99p')","Use 'NONE' to disable speculative retries and re-evaluate the intended tuning"],"exampleFix":"// before\nALTER TABLE ks.tbl WITH speculative_retry = 'MIN(50ms, 95ms)';\n// after\nALTER TABLE ks.tbl WITH speculative_retry = 'MIN(50ms, 95p)';","handlingStrategy":"validation","validationCode":"function isValidSpeculativeRetry(v) {\n  const m = /^(MIN|MAX)\\(([^,]+),([^,]+)\\)$/i.exec(v.trim());\n  if (!m) return false;\n  const kind = s => /p$|percentile$/i.test(s.trim()) ? 'percentile' : 'fixed';\n  return kind(m[2]) !== kind(m[3]);\n}\nif (!isValidSpeculativeRetry('MIN(50ms, 95p)')) throw new Error('MIN/MAX needs one fixed and one percentile arg');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair one 'ms' value with one 'p' value inside MIN()/MAX()","Use DESCRIBE TABLE to copy known-good speculative_retry syntax","Validate table options in CI with a CREATE TABLE smoke test against a test keyspace"],"tags":["configuration","cql","speculative-retry"],"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"}