apache/cassandra · error · IllegalArgumentException

Invalid parameter list for uniform distribution:

Error message

Invalid parameter list for uniform distribution: 

What it means

GaussianImpl.getFactory() wraps parsing of GAUSSIAN(min..max[,...]) parameters in a try/catch; if parsing the min..max bounds or the numeric mean/stdev parameters fails for any reason (NumberFormatException, ArrayIndexOutOfBounds from a malformed range), it rethrows IllegalArgumentException. Note the message incorrectly says 'uniform' due to a copy-paste bug in the source, but the error originates from the Gaussian distribution parser.

Source

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

                final long max = parseLong(bounds[1]);
                final double mean, stdev;
                if (params.size() == 3)
                {
                    mean = Double.parseDouble(params.get(1));
                    stdev = Double.parseDouble(params.get(2));
                }
                else
                {
                    final double stdevsToEdge = params.size() == 1 ? 3d : Double.parseDouble(params.get(1));
                    mean = (min + max) / 2d;
                    stdev = ((max - min) / 2d) / stdevsToEdge;
                }
                if (min == max)
                    return new FixedFactory(min);
                return new GaussianFactory(min, max, mean, stdev);
            } catch (Exception ignore)
            {
                throw new IllegalArgumentException("Invalid parameter list for uniform distribution: " + params);
            }
        }
    }

    private static final class ExponentialImpl implements Impl
    {
        @Override
        public DistributionFactory getFactory(List<String> params)
        {
            if (params.size() != 1)
                throw new IllegalArgumentException("Invalid parameter list for gaussian distribution: " + params);
            try
            {
                String[] bounds = params.get(0).split("\\.\\.+");
                final long min = parseLong(bounds[0]);
                final long max = parseLong(bounds[1]);
                if (min == max)
                    return new FixedFactory(min);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Ensure the first parameter is a valid min..max range with the '..' separator, e.g. GAUSSIAN(1..1000).
  2. Ensure optional parameters are numeric: GAUSSIAN(min..max,stdvrng) or GAUSSIAN(min..max,mean,stdev).
  3. If min==max, omit the extra parameters — the parser returns a fixed distribution — and verify bound values parse (k/m/b suffixes are supported, e.g. 10k).

Example fix

// before
OptionDistribution.getFactory(Arrays.asList("1..1000,three"))
// after
OptionDistribution.getFactory(Arrays.asList("1..1000", "3"))
Defensive patterns

Strategy: validation

Validate before calling

String spec = "1..1000"; // first GAUSSIAN param
String[] bounds = spec.split("\\.\\..");
if (bounds.length != 2)
    throw new IllegalArgumentException("Range must be min..max: " + spec);
Long.parseLong(bounds[0]); Long.parseLong(bounds[1]);
for (int i = 1; i < params.size(); i++) Double.parseDouble(params.get(i));

Try / catch

try {
    DistributionFactory f = gaussianImpl.getFactory(params);
} catch (IllegalArgumentException e) {
    log.warn("Invalid GAUSSIAN spec {} (note: message text may say 'uniform' due to a known source copy-paste bug)", params, e);
}

Prevention

When it happens

Trigger: Calling getFactory with params like ['abc..100'], ['1..100,notanumber'], ['1'] (no '..' separator so bounds[1] is missing), or ['100..1'] with non-numeric bound strings.

Common situations: Typos in cassandra-stress CLI distribution specs such as GAUSSIAN(1..1000,x) or GAUSSIAN(1..1000;3) using the wrong separator, using suffixes parseLong doesn't understand, or forgetting the '..' between min and max.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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