{"record":{"id":"07754204ca497315","repo":"apache/cassandra","slug":"invalid-parameter-list-for-sequence-distribution-077542","errorCode":null,"errorMessage":"Invalid parameter list for sequence distribution (min==max): ","messagePattern":"Invalid parameter list for sequence distribution \\(min==max\\): ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java","lineNumber":390,"sourceCode":"\n        @Override\n        public DistributionFactory getFactory(List<String> params)\n        {\n            if (params.size() != 1)\n                throw new IllegalArgumentException(\"Invalid parameter list for sequence distribution: \" + params);\n            final long min;\n            final long max;\n            try\n            {\n                String[] bounds = params.get(0).split(\"\\\\.\\\\.+\");\n                min = parseLong(bounds[0]);\n                max = parseLong(bounds[1]);\n            } catch (Exception ignore)\n            {\n                throw new IllegalArgumentException(\"Invalid parameter list for sequence distribution: \" + params);\n            }\n            if (min == max)\n                throw new IllegalArgumentException(\"Invalid parameter list for sequence distribution (min==max): \" + params);\n\n            if (min > max)\n                throw new IllegalArgumentException(\"Invalid parameter list for sequence distribution (min>max): \" + params);\n\n            return new SequenceFactory(min, max);\n\n        }\n    }\n\n\n    private static final class InverseFactory implements DistributionFactory\n    {\n        final DistributionFactory wrapped;\n        private InverseFactory(DistributionFactory wrapped)\n        {\n            this.wrapped = wrapped;\n        }\n","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java#L372-L408","documentation":"The sequence distribution additionally rejects degenerate ranges where min equals max, since a sequence between two identical values is meaningless (it is what the fixed distribution is for). This exact IllegalArgumentException is thrown for such specs.","triggerScenarios":"Calling getFactory for the sequence impl where parsed min and max are equal, e.g. SEQ(1000..1000).","commonSituations":"Programmatically generated ranges whose bounds collapse to one value (e.g. both computed from the same variable); copy/paste of the same number for both bounds.","solutions":["Use FIX(value) when you want a constant population/value","Give min and max distinct values: SEQ(1..1000)","Add a bounds check in scripts generating the spec: throw if min >= max."],"exampleFix":"// before\n-pop seq=SEQ(1000..1000)\n// after\n-pop seq=FIX(1000)","handlingStrategy":"validation","validationCode":"boolean isDegenerate(long min, long max){ return min == max; } // require min < max for SEQ","typeGuard":null,"tryCatchPattern":"try { DistributionFactory f = seq.getFactory(params); } catch (IllegalArgumentException e) { return OptionDistribution.get(\"FIX(\" + min + \")\"); }","preventionTips":["When generating bounds programmatically, assert min < max","Map single-value cases to FIX(...) instead of SEQ(v..v)","Unit-test spec generators for degenerate inputs"],"tags":["cli","argument-validation","range"],"backgroundTag":"invalid-argument-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"}