apache/cassandra · error · IllegalArgumentException

No command specified

Error message

No command specified

What it means

StressSettings.get builds the configuration from the parsed command line; if no recognized command (write, read, mixed, user, counter_write, help, etc.) was supplied, SettingsCommand.get returns null and IllegalArgumentException 'No command specified' is thrown.

Source

Thrown at tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java:200

        boolean first = true;
        for (String arg : args)
        {
            if (!first)
                sb.append(" ");
            sb.append(arg);
            first = false;
        }
        return sb.toString()
                 .replaceAll("\\s+([,=()])", "$1")
                 .replaceAll("([,=(])\\s+", "$1")
                 .split(" +");
    }

    public static StressSettings get(Map<String, String[]> clArgs)
    {
        SettingsCommand command = SettingsCommand.get(clArgs);
        if (command == null)
            throw new IllegalArgumentException("No command specified");
        SettingsPort port = SettingsPort.get(clArgs);
        SettingsRate rate = SettingsRate.get(clArgs, command);
        SettingsPopulation generate = SettingsPopulation.get(clArgs, command);
        SettingsTokenRange tokenRange = SettingsTokenRange.get(clArgs);
        SettingsInsert insert = SettingsInsert.get(clArgs);
        SettingsColumn columns = SettingsColumn.get(clArgs);
        SettingsErrors errors = SettingsErrors.get(clArgs);
        SettingsLog log = SettingsLog.get(clArgs);
        SettingsCredentials credentials = SettingsCredentials.get(clArgs);
        SettingsMode mode = SettingsMode.get(clArgs, credentials);
        SettingsNode node = SettingsNode.get(clArgs);
        SettingsSchema schema = SettingsSchema.get(clArgs, command);
        SettingsTransport transport = SettingsTransport.get(clArgs, credentials);
        SettingsJMX jmx = SettingsJMX.get(clArgs, credentials);
        SettingsGraph graph = SettingsGraph.get(clArgs, command);
        SettingsReporting reporting = SettingsReporting.get(clArgs);
        if (!clArgs.isEmpty())
        {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Add a command: cassandra-stress write|read|mixed|counter_write|user ...
  2. If using the user command, also pass profile=<yaml> with ops specification
  3. Run 'cassandra-stress help' to see the list of valid commands

Example fix

// before
cassandra-stress -rate threads=10
// after
cassandra-stress write -rate threads=10
Defensive patterns

Strategy: validation

Validate before calling

Set<String> commands = Set.of("write","read","mixed","counter_write","user","help","version","legacy","validate");
if (args.length == 0 || !commands.contains(args[0]))
    throw new IllegalArgumentException("first argument must be a command");

Try / catch

try { StressSettings.get(parseMap(args)); } catch (IllegalArgumentException e) { if (e.getMessage().equals("No command specified")) { printUsage(); System.exit(2); } else throw e; }

Prevention

When it happens

Trigger: Running 'cassandra-stress' (or bin/cassandra-stress) with only global options like -node or -rate but no command word, e.g. 'cassandra-stress -rate threads=10'.

Common situations: Scripts where the command variable was empty, users typing options first and forgetting the operation, or a wrapper script dropping the first positional argument.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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