apache/cassandra · error · IllegalArgumentException

Invalid command/option provided to help

Error message

Invalid command/option provided to help

What it means

The 'help' pseudo-command of cassandra-stress accepts exactly one argument (a command or option name). maybePrintHelp throws IllegalArgumentException when 'help' is given more than one extra token, since there is no way to disambiguate what to print help for.

Source

Thrown at tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java:127

                if (clArgs.size() == 1)
                {
                    String p = clArgs.keySet().iterator().next();
                    if (clArgs.get(p).length == 0)
                        params = new String[]{ p };
                }
            }
            else
            {
                printHelp();
                return true;
            }
        }
        if (params.length == 1)
        {
            printHelp(params[0]);
            return true;
        }
        throw new IllegalArgumentException("Invalid command/option provided to help");
    }

    private static boolean maybePrintVersion(Map<String, String[]> clArgs)
    {
        if (clArgs.containsKey("version"))
        {
            try
            {
                URL url = Resources.getResource("org/apache/cassandra/config/version.properties");
                System.out.println(parseVersionFile(Resources.toString(url, Charsets.UTF_8)));
            }
            catch (IOException e)
            {
                e.printStackTrace(System.err);
            }
            return true;
        }
        return false;

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Pass only one command or option name after help: 'help read' or 'help -rate'
  2. Run 'cassandra-stress help' with no arguments to list all commands and options
  3. Request help for each item in a separate invocation

Example fix

// before
cassandra-stress help read write
// after
cassandra-stress help read
cassandra-stress help write
Defensive patterns

Strategy: validation

Validate before calling

String[] rest = clArgs.get("help");
if (rest != null && rest.length > 1)
    throw new IllegalArgumentException("help takes at most one command/option");

Try / catch

try { runStress(args); } catch (IllegalArgumentException e) { if (e.getMessage().equals("Invalid command/option provided to help")) printUsageAndExit(); else throw e; }

Prevention

When it happens

Trigger: Invoking 'cassandra-stress help <a> <b>' with two or more tokens after 'help', i.e. params.length > 1 in maybePrintHelp.

Common situations: Typing 'help read write' trying to see help for two commands at once, or accidentally passing extra flags after help.

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/c6238630591e928a. Report an issue: GitHub.