{"record":{"id":"cec3ebf933bbcd95","repo":"apache/cassandra","slug":"no-command-specified","errorCode":null,"errorMessage":"No command specified","messagePattern":"No command specified","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java","lineNumber":200,"sourceCode":"        boolean first = true;\n        for (String arg : args)\n        {\n            if (!first)\n                sb.append(\" \");\n            sb.append(arg);\n            first = false;\n        }\n        return sb.toString()\n                 .replaceAll(\"\\\\s+([,=()])\", \"$1\")\n                 .replaceAll(\"([,=(])\\\\s+\", \"$1\")\n                 .split(\" +\");\n    }\n\n    public static StressSettings get(Map<String, String[]> clArgs)\n    {\n        SettingsCommand command = SettingsCommand.get(clArgs);\n        if (command == null)\n            throw new IllegalArgumentException(\"No command specified\");\n        SettingsPort port = SettingsPort.get(clArgs);\n        SettingsRate rate = SettingsRate.get(clArgs, command);\n        SettingsPopulation generate = SettingsPopulation.get(clArgs, command);\n        SettingsTokenRange tokenRange = SettingsTokenRange.get(clArgs);\n        SettingsInsert insert = SettingsInsert.get(clArgs);\n        SettingsColumn columns = SettingsColumn.get(clArgs);\n        SettingsErrors errors = SettingsErrors.get(clArgs);\n        SettingsLog log = SettingsLog.get(clArgs);\n        SettingsCredentials credentials = SettingsCredentials.get(clArgs);\n        SettingsMode mode = SettingsMode.get(clArgs, credentials);\n        SettingsNode node = SettingsNode.get(clArgs);\n        SettingsSchema schema = SettingsSchema.get(clArgs, command);\n        SettingsTransport transport = SettingsTransport.get(clArgs, credentials);\n        SettingsJMX jmx = SettingsJMX.get(clArgs, credentials);\n        SettingsGraph graph = SettingsGraph.get(clArgs, command);\n        SettingsReporting reporting = SettingsReporting.get(clArgs);\n        if (!clArgs.isEmpty())\n        {","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/StressSettings.java#L182-L218","documentation":"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.","triggerScenarios":"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'.","commonSituations":"Scripts where the command variable was empty, users typing options first and forgetting the operation, or a wrapper script dropping the first positional argument.","solutions":["Add a command: cassandra-stress write|read|mixed|counter_write|user ...","If using the user command, also pass profile=<yaml> with ops specification","Run 'cassandra-stress help' to see the list of valid commands"],"exampleFix":"// before\ncassandra-stress -rate threads=10\n// after\ncassandra-stress write -rate threads=10","handlingStrategy":"validation","validationCode":"Set<String> commands = Set.of(\"write\",\"read\",\"mixed\",\"counter_write\",\"user\",\"help\",\"version\",\"legacy\",\"validate\");\nif (args.length == 0 || !commands.contains(args[0]))\n    throw new IllegalArgumentException(\"first argument must be a command\");","typeGuard":null,"tryCatchPattern":"try { StressSettings.get(parseMap(args)); } catch (IllegalArgumentException e) { if (e.getMessage().equals(\"No command specified\")) { printUsage(); System.exit(2); } else throw e; }","preventionTips":["Always put the command word right after the binary name","In scripts, guard the command variable for non-empty valid values","Run 'cassandra-stress help' to confirm command names"],"tags":["cli","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}