apache/cassandra · error · IllegalArgumentException

Invalid parameter

Error message

Invalid parameter ${param}

What it means

GroupedOptions.select tries every param against each option grouping; any parameter not accepted by any grouping is invalid, and the method throws IllegalArgumentException naming it. This is the generic 'unknown option' failure of cassandra-stress grouped CLI option parsing.

Solutions

  1. Fix or remove the offending parameter on the command line
  2. Run the subcommand with no args or -h to print its valid options
  3. Check the option name against the current version's documentation (options change between versions)

Example fix

// before
stress write -cl=QUORUM -wrongopt=5
// after
stress write -cl=QUORUM -pop seq=1..1000
Defensive patterns

Strategy: try-catch

Try / catch

try { G opts = GroupedOptions.select(params, groupings); }
catch (IllegalArgumentException e) { System.err.println("Unknown option: " + e.getMessage() + "; run with -h for usage"); System.exit(2); }

Prevention

When it happens

Trigger: Passing an unrecognized option/flag to a stress subcommand, e.g. stress write -foo=bar, or misspelling an option name so no grouping accepts it.

Common situations: Typo'd flags on the stress command line; copying options valid for one subcommand to another; outdated option names after version upgrades.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at tools/stress/src/org/apache/cassandra/stress/settings/GroupedOptions.java:70

        for (Option option : options())
            if (!option.happy())
                return false;
        return true;
    }

    public abstract List<? extends Option> options();

    // hands the parameters to each of the option groups, and returns the first provided
    // option group that is happy() after this is done, that also accepted all the parameters
    public static <G extends GroupedOptions> G select(String[] params, G... groupings)
    {
        for (String param : params)
        {
            boolean accepted = false;
            for (GroupedOptions grouping : groupings)
                accepted |= grouping.accept(param);
            if (!accepted)
                throw new IllegalArgumentException("Invalid parameter " + param);
        }
        for (G grouping : groupings)
            if (grouping.happy() && grouping.accepted == params.length)
                return grouping;
        return null;
    }

    // pretty prints all of the option groupings
    public static void printOptions(PrintStream out, String command, GroupedOptions... groupings)
    {
        out.println();
        boolean firstRow = true;
        for (GroupedOptions grouping : groupings)
        {
            if (!firstRow)
            {
                out.println(" OR ");
            }

View on GitHub (pinned to 88fd0f6a0e)