apache/cassandra · error · IllegalArgumentException

Illegal distribution type:

Error message

Illegal distribution type: 

What it means

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>'.

Solutions

  1. Use a supported distribution name: gaussian, uniform, fixed, exponential, extreme, binomial, etc.
  2. Check the spelling of the distribution name against OptionDistribution's Impl list
  3. Consult `stress help` for the list of valid distribution types in your version

Example fix

// before
-pop norm(1..100)
// after
-pop gaussian(1..100)
Defensive patterns

Strategy: validation

Validate before calling

Set<String> valid = Set.of("gaussian","uniform","fixed","exponential","extreme","binomial","zipf");
String name = spec.replaceFirst("~?\\w+\\((.*)\\)", "$1");
if (!valid.contains(name.toLowerCase())) throw new IllegalArgumentException("Unknown distribution type: " + name);

Type guard

boolean isKnownDistType(String name) { return OptionDistribution.hasImpl(name); }

Try / catch

try { OptionDistribution.get(spec); } catch (IllegalArgumentException e) { log.error("Unknown distribution type in '{}': use gaussian/uniform/fixed/exponential/...", spec); }

Prevention

When it happens

Trigger: 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.

Common situations: Using distribution names from other tools/libraries; typos like 'unifrom' or 'gausian'; expecting a distribution type that this Cassandra version does not support.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/ddb967ecd796d7b3. Report an issue: GitHub.

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java:105

    @Override
    public boolean accept(String param)
    {
        if (!toLowerCaseLocalized(param).startsWith(prefix))
            return false;
        spec = param.substring(prefix.length());
        return true;
    }

    public static DistributionFactory get(String spec)
    {
        Matcher m = FULL.matcher(spec);
        if (!m.matches())
            throw new IllegalArgumentException("Illegal distribution specification: " + spec);
        boolean inverse = m.group(1).equals("~");
        String name = m.group(2);
        Impl impl = LOOKUP.get(toLowerCaseLocalized(name));
        if (impl == null)
            throw new IllegalArgumentException("Illegal distribution type: " + name);
        List<String> params = new ArrayList<>();
        m = ARGS.matcher(m.group(3));
        while (m.find())
            params.add(m.group());
        DistributionFactory factory = impl.getFactory(params);
        return inverse ? new InverseFactory(factory) : factory;
    }

    public DistributionFactory get()
    {
        return spec != null ? get(spec) : defaultSpec != null ? get(defaultSpec) : null;
    }

    @Override
    public boolean happy()
    {
        return !required || spec != null;
    }

View on GitHub (pinned to 88fd0f6a0e)