{"record":{"id":"1f8596d378c0ff20","repo":"apache/cassandra","slug":"invalid-parameter-list-for-sequence-distribution-1f8596","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":393,"sourceCode":"        {\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\n        public Distribution get()\n        {\n            return new DistributionInverted(wrapped.get());","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java#L375-L411","documentation":"Guard in OptionDistribution.getFactory for the 'seq' distribution: the min:max bounds parsed from the single parameter were inverted (min > max), so no valid increasing sequence exists. Thrown as IllegalArgumentException for malformed stress CLI distribution arguments.","triggerScenarios":"SEQ spec with bounds in descending order, e.g. SEQ(1000..1) or SEQ(-5..-100).","commonSituations":"Hand-typed ranges written high-to-low out of habit; bounds read from config in reverse order; programmatically generated specs without ordering normalization.","solutions":["Swap the bounds so min comes first: SEQ(1..1000)","Normalize in code with Math.min/Math.max before building the spec string","If descending iteration is intended, iterate a normal range in reverse instead."],"exampleFix":"// before\n-pop seq=SEQ(1000..1)\n// after\n-pop seq=SEQ(1..1000)","handlingStrategy":"validation","validationCode":"long lo = Math.min(a, b), hi = Math.max(a, b); String spec = \"SEQ(\" + lo + \"..\" + hi + \")\";","typeGuard":null,"tryCatchPattern":"try { DistributionFactory f = seq.getFactory(params); } catch (IllegalArgumentException e) { normalizeBoundsAndRetry(); }","preventionTips":["Normalize bounds with Math.min/Math.max before formatting the spec","Validate ordering in config loaders","Educate users that ranges are written min..max"],"tags":["cli","argument-validation","range"],"backgroundTag":"value-out-of-range","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"}