{"record":{"id":"ddb967ecd796d7b3","repo":"apache/cassandra","slug":"illegal-distribution-type","errorCode":null,"errorMessage":"Illegal distribution type: ","messagePattern":"Illegal distribution type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java","lineNumber":105,"sourceCode":"    @Override\n    public boolean accept(String param)\n    {\n        if (!toLowerCaseLocalized(param).startsWith(prefix))\n            return false;\n        spec = param.substring(prefix.length());\n        return true;\n    }\n\n    public static DistributionFactory get(String spec)\n    {\n        Matcher m = FULL.matcher(spec);\n        if (!m.matches())\n            throw new IllegalArgumentException(\"Illegal distribution specification: \" + spec);\n        boolean inverse = m.group(1).equals(\"~\");\n        String name = m.group(2);\n        Impl impl = LOOKUP.get(toLowerCaseLocalized(name));\n        if (impl == null)\n            throw new IllegalArgumentException(\"Illegal distribution type: \" + name);\n        List<String> params = new ArrayList<>();\n        m = ARGS.matcher(m.group(3));\n        while (m.find())\n            params.add(m.group());\n        DistributionFactory factory = impl.getFactory(params);\n        return inverse ? new InverseFactory(factory) : factory;\n    }\n\n    public DistributionFactory get()\n    {\n        return spec != null ? get(spec) : defaultSpec != null ? get(defaultSpec) : null;\n    }\n\n    @Override\n    public boolean happy()\n    {\n        return !required || spec != null;\n    }","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java#L87-L123","documentation":"After the distribution spec matches the overall name(args) shape, OptionDistribution.get looks up the distribution name in the Impl LOOKUP table (gaussian, uniform, fixed, exponential, etc.). An unknown name yields IllegalArgumentException 'Illegal distribution type: <name>'.","triggerScenarios":"Passing a distribution spec with an unrecognized type name, e.g. -pop weibull(1..100) or norm(1..10), where the name is not one of the registered Impl entries.","commonSituations":"Using distribution names from other tools/libraries; typos like 'unifrom' or 'gausian'; expecting a distribution type that this Cassandra version does not support.","solutions":["Use a supported distribution name: gaussian, uniform, fixed, exponential, extreme, binomial, etc.","Check the spelling of the distribution name against OptionDistribution's Impl list","Consult `stress help` for the list of valid distribution types in your version"],"exampleFix":"// before\n-pop norm(1..100)\n// after\n-pop gaussian(1..100)","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"gaussian\",\"uniform\",\"fixed\",\"exponential\",\"extreme\",\"binomial\",\"zipf\");\nString name = spec.replaceFirst(\"~?\\\\w+\\\\((.*)\\\\)\", \"$1\");\nif (!valid.contains(name.toLowerCase())) throw new IllegalArgumentException(\"Unknown distribution type: \" + name);","typeGuard":"boolean isKnownDistType(String name) { return OptionDistribution.hasImpl(name); }","tryCatchPattern":"try { OptionDistribution.get(spec); } catch (IllegalArgumentException e) { log.error(\"Unknown distribution type in '{}': use gaussian/uniform/fixed/exponential/...\", spec); }","preventionTips":["Use only distribution names listed in stress help","Avoid importing distribution names from other tools","Pin profiles to distribution types supported by your Cassandra version"],"tags":["cli","distribution","argument-parsing"],"backgroundTag":"invalid-enum-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"}