{"record":{"id":"661c405b215a54a6","repo":"apache/cassandra","slug":"invalid-parameter-list-for-uniform-distribution","errorCode":null,"errorMessage":"Invalid parameter list for uniform distribution: ","messagePattern":"Invalid parameter list for uniform distribution: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java","lineNumber":242,"sourceCode":"                final long max = parseLong(bounds[1]);\n                final double mean, stdev;\n                if (params.size() == 3)\n                {\n                    mean = Double.parseDouble(params.get(1));\n                    stdev = Double.parseDouble(params.get(2));\n                }\n                else\n                {\n                    final double stdevsToEdge = params.size() == 1 ? 3d : Double.parseDouble(params.get(1));\n                    mean = (min + max) / 2d;\n                    stdev = ((max - min) / 2d) / stdevsToEdge;\n                }\n                if (min == max)\n                    return new FixedFactory(min);\n                return new GaussianFactory(min, max, mean, stdev);\n            } catch (Exception ignore)\n            {\n                throw new IllegalArgumentException(\"Invalid parameter list for uniform distribution: \" + params);\n            }\n        }\n    }\n\n    private static final class ExponentialImpl implements Impl\n    {\n        @Override\n        public DistributionFactory getFactory(List<String> params)\n        {\n            if (params.size() != 1)\n                throw new IllegalArgumentException(\"Invalid parameter list for gaussian distribution: \" + params);\n            try\n            {\n                String[] bounds = params.get(0).split(\"\\\\.\\\\.+\");\n                final long min = parseLong(bounds[0]);\n                final long max = parseLong(bounds[1]);\n                if (min == max)\n                    return new FixedFactory(min);","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java#L224-L260","documentation":"GaussianImpl.getFactory() wraps parsing of GAUSSIAN(min..max[,...]) parameters in a try/catch; if parsing the min..max bounds or the numeric mean/stdev parameters fails for any reason (NumberFormatException, ArrayIndexOutOfBounds from a malformed range), it rethrows IllegalArgumentException. Note the message incorrectly says 'uniform' due to a copy-paste bug in the source, but the error originates from the Gaussian distribution parser.","triggerScenarios":"Calling getFactory with params like ['abc..100'], ['1..100,notanumber'], ['1'] (no '..' separator so bounds[1] is missing), or ['100..1'] with non-numeric bound strings.","commonSituations":"Typos in cassandra-stress CLI distribution specs such as GAUSSIAN(1..1000,x) or GAUSSIAN(1..1000;3) using the wrong separator, using suffixes parseLong doesn't understand, or forgetting the '..' between min and max.","solutions":["Ensure the first parameter is a valid min..max range with the '..' separator, e.g. GAUSSIAN(1..1000).","Ensure optional parameters are numeric: GAUSSIAN(min..max,stdvrng) or GAUSSIAN(min..max,mean,stdev).","If min==max, omit the extra parameters — the parser returns a fixed distribution — and verify bound values parse (k/m/b suffixes are supported, e.g. 10k)."],"exampleFix":"// before\nOptionDistribution.getFactory(Arrays.asList(\"1..1000,three\"))\n// after\nOptionDistribution.getFactory(Arrays.asList(\"1..1000\", \"3\"))","handlingStrategy":"validation","validationCode":"String spec = \"1..1000\"; // first GAUSSIAN param\nString[] bounds = spec.split(\"\\\\.\\\\..\");\nif (bounds.length != 2)\n    throw new IllegalArgumentException(\"Range must be min..max: \" + spec);\nLong.parseLong(bounds[0]); Long.parseLong(bounds[1]);\nfor (int i = 1; i < params.size(); i++) Double.parseDouble(params.get(i));","typeGuard":null,"tryCatchPattern":"try {\n    DistributionFactory f = gaussianImpl.getFactory(params);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Invalid GAUSSIAN spec {} (note: message text may say 'uniform' due to a known source copy-paste bug)\", params, e);\n}","preventionTips":["Always write ranges as min..max with the double-dot separator.","Keep mean/stdev as plain decimal numbers (dot separator, no units).","Pre-compile specs in a smoke test before launching long stress runs."],"tags":["cassandra","cli","number-format","distribution"],"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-14T16:17:12.679Z"}