apache/cassandra · error · IllegalArgumentException

Invalid command or option provided to command help

Error message

Invalid command or option provided to command help

What it means

printHelp(command) resolves the requested token against known stress commands and options; when the token matches neither, it prints the generic help and throws IllegalArgumentException so the caller sees the argument was invalid.

Source

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

        }
    }

    public static void printHelp(String command)
    {
        Command cmd = Command.get(command);
        if (cmd != null)
        {
            cmd.printHelp();
            return;
        }
        CliOption opt = CliOption.get(command);
        if (opt != null)
        {
            opt.printHelp();
            return;
        }
        printHelp();
        throw new IllegalArgumentException("Invalid command or option provided to command help");
    }

    static Runnable helpHelpPrinter()
    {
        return () -> {
            System.out.println("Usage: ./bin/cassandra-stress help <command|option>");
            System.out.println("Commands:");
            for (Command cmd : Command.values())
                System.out.println("    " + cmd.names.toString().replaceAll("\\[|\\]", ""));
            System.out.println("Options:");
            for (CliOption op : CliOption.values())
                System.out.println("    -" + toLowerCaseLocalized(op.toString()) + (op.extraName != null ? ", " + op.extraName : ""));
        };
    }

    static Runnable printHelpPrinter()
    {
        return () -> GroupedOptions.printOptions(System.out, "print", new GroupedOptions()

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Check the spelling against the list printed by 'cassandra-stress help'
  2. Use 'help <command>' for commands (write, read, mixed, user) or 'help -<option>' for option groups (-rate, -log, -schema)
  3. Run bare 'cassandra-stress help' to enumerate valid names for your version

Example fix

// before
cassandra-stress help inser
// after
cassandra-stress help insert
Defensive patterns

Strategy: validation

Validate before calling

Set<String> known = Set.of("write","read","mixed","counter_write","user","-rate","-log","-schema","-node","-port","-mode");
if (helpTopic != null && !known.contains(helpTopic)) System.out.println("unknown help topic: " + helpTopic);

Try / catch

try { printHelp(topic); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Invalid command or option")) printGeneralHelp(); else throw e; }

Prevention

When it happens

Trigger: Running 'cassandra-stress help foo' where 'foo' is not a recognized command or option name (opt == null and cmd == null in printHelp).

Common situations: Typos ('cassandra-stress help inser'), asking for help on an option that belongs to another tool, or help names changed across Cassandra versions.

Related errors


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