{"record":{"id":"c119391ab9dd3679","repo":"apache/cassandra","slug":"input-does-not-match-randomizer","errorCode":null,"errorMessage":"${input} does not match${RANDOMIZER}","messagePattern":"(.+?) does not match(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/RetryStrategy.java","lineNumber":331,"sourceCode":"            throw new IllegalArgumentException(\"Invalid to specify randomiser when no range specified: '\" + original + '\\'');\n        if (min instanceof Wait.Constant && minMin != 0)\n            throw new IllegalArgumentException(\"Invalid to specify an absolute minimum constant when the min bound is itself a constant: '\" + original + '\\'');\n        long maxMin = parseInMicros(m.group(\"maxmin\"), Long.MAX_VALUE);\n        if (min instanceof Wait.Constant && maxMin != Long.MAX_VALUE)\n            throw new IllegalArgumentException(\"Invalid to specify an absolute max(min) constant when the min bound is itself a constant: '\" + original + '\\'');\n        if (max instanceof Wait.Constant && maxMax != Long.MAX_VALUE)\n            throw new IllegalArgumentException(\"Invalid to specify an absolute maximum constant when the max bound is itself a constant: '\" + original + '\\'');\n        if (randomizer == null)\n            randomizer = randomizers.uniform();\n        return new RetryStrategy(randomizer, minMin, min, maxMin, max, maxMax, retries);\n    }\n\n    @VisibleForTesting\n    protected static WaitRandomizer parseWaitRandomizer(String input)\n    {\n        Matcher m = RANDOMIZER.matcher(input);\n        if (!m.matches())\n            throw new IllegalArgumentException(input + \" does not match\" + RANDOMIZER);\n\n        String exp;\n        exp = m.group(\"exp\");\n        if (exp != null)\n            return randomizers.exponential(Double.parseDouble(exp));\n        exp = m.group(\"qexp\");\n        if (exp != null)\n            return randomizers.quantizedExponential(Double.parseDouble(exp));\n        return randomizers.uniform();\n    }\n}\n","sourceCodeStart":313,"sourceCodeEnd":343,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/RetryStrategy.java#L313-L343","documentation":"parseWaitRandomizer validates the rnd value against the RANDOMIZER regex, which accepts forms like 'uniform', 'exp(<factor>)', and 'qexp(<factor>)'. Unrecognised input throws an IllegalArgumentException showing the input and the expected pattern.","triggerScenarios":"A ',rnd=<value>' modifier whose value is not a valid randomizer form, e.g. \"100ms..1s,rnd=random\" or \"100ms..1s,rnd=exponential(2)\" (spelled out instead of 'exp').","commonSituations":"Typos in randomizer names; using long names ('exponential', 'quantized') instead of the accepted 'exp'/'qexp' abbreviations; configs ported from systems with different randomizer vocabularies.","solutions":["Use one of the accepted forms: uniform, exp(<factor>), or qexp(<factor>) — e.g. rnd=exp(2)","Omit the rnd modifier entirely to get the default uniform randomizer","Compare your input against the RANDOMIZER pattern printed in the exception message"],"exampleFix":"// before\nRetryStrategy.parse(\"100ms..1s,rnd=exponential(2)\", latencies);\n// after\nRetryStrategy.parse(\"100ms..1s,rnd=exp(2)\", latencies);","handlingStrategy":"validation","validationCode":"private static final Pattern RND_PATTERN = Pattern.compile(\"uniform|exp\\\\(\\\\d+(\\\\.\\\\d+)?\\\\)|qexp\\\\(\\\\d+(\\\\.\\\\d+)?\\\\)\");\nstatic void validateRndValue(String value) {\n    if (!RND_PATTERN.matcher(value.trim()).matches())\n        throw new IllegalArgumentException(\"rnd value '\" + value + \"' must be uniform, exp(<f>), or qexp(<f>)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    RetryStrategy strategy = RetryStrategy.parse(spec, latencies);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"does not match\")) {\n        throw new ConfigurationException(\"Invalid rnd value in '\" + spec + \"'; use uniform, exp(<factor>) or qexp(<factor>)\");\n    }\n    throw e;\n}","preventionTips":["Use the abbreviations exp and qexp, not spelled-out names","Omit rnd entirely when uniform behavior is acceptable","Check the RANDOMIZER pattern in the exception message when unsure of syntax"],"tags":["configuration","parsing","regex","illegal-argument"],"backgroundTag":"invalid-argument-format","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"}