{"record":{"id":"53ef724d764473f7","repo":"apache/cassandra","slug":"invalid-parameter-list-for-extreme-weibull-distr","errorCode":null,"errorMessage":"Invalid parameter list for extreme (Weibull) distribution: ","messagePattern":"Invalid parameter list for extreme \\(Weibull\\) distribution: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java","lineNumber":279,"sourceCode":"                ExponentialDistribution findBounds = new ExponentialDistribution(1d);\n                // max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,\n                // over entire range, but this results in overly skewed distribution, so take sqrt\n                final double mean = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));\n                return new ExpFactory(min, max, mean);\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 ExtremeImpl implements Impl\n    {\n        @Override\n        public DistributionFactory getFactory(List<String> params)\n        {\n            if (params.size() != 2)\n                throw new IllegalArgumentException(\"Invalid parameter list for extreme (Weibull) 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);\n                final double shape = Double.parseDouble(params.get(1));\n                WeibullDistribution findBounds = new WeibullDistribution(shape, 1d);\n                // max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,\n                // over entire range, but this results in overly skewed distribution, so take sqrt\n                final double scale = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));\n                return new ExtremeFactory(min, max, shape, scale);\n            } catch (Exception ignore)\n            {\n                throw new IllegalArgumentException(\"Invalid parameter list for extreme (Weibull) distribution: \" + params);\n            }\n        }","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java#L261-L297","documentation":"ExtremeImpl.getFactory() parses EXTREME(min..max,shape) specs (Weibull distribution) and throws IllegalArgumentException when the parameter list does not contain exactly 2 entries. Both the range and the shape parameter are required.","triggerScenarios":"Calling getFactory with 1 parameter ('extr(1..1000)' missing the shape) or 3+ parameters ('extr(1..1000,2,3)'), including empty trailing-comma arguments.","commonSituations":"Users omitting the required Weibull shape argument because UNIFORM/EXP only need a range, or copying QEXTREME syntax (which takes 3 params) but invoking the plain EXTREME alias.","solutions":["Supply exactly two parameters: EXTREME(min..max,shape), e.g. EXTREME(1..1000,2.5).","If you only want a range, use UNIFORM(min..max) or EXP(min..max) instead.","If you intended the quantized variant, use QEXTREME(min..max,shape,quantas) with 3 parameters."],"exampleFix":"// before\nEXTREME(1..1000)\n// after\nEXTREME(1..1000, 2.5)","handlingStrategy":"validation","validationCode":"List<String> params = ...; // from EXTREME(...)\nif (params.size() != 2)\n    throw new IllegalArgumentException(\"EXTREME expects exactly 2 params min..max,shape, got \" + params);\nDouble.parseDouble(params.get(1)); // shape must be numeric","typeGuard":null,"tryCatchPattern":"try {\n    DistributionFactory f = extremeImpl.getFactory(params);\n} catch (IllegalArgumentException e) {\n    System.err.println(\"EXTREME requires (min..max, shape): \" + e.getMessage());\n}","preventionTips":["Always include the Weibull shape parameter with EXTREME/extr/weibull.","Use QEXTREME with 3 params only when quantization is intended.","Validate arity before invoking getFactory in generated profiles."],"tags":["cassandra","cli","argument-count","distribution"],"backgroundTag":"invalid-cli-argument","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"}