{"record":{"id":"751adad3b8474963","repo":"apache/cassandra","slug":"invalid-command-or-option-provided-to-command-help","errorCode":null,"errorMessage":"Invalid command or option provided to command help","messagePattern":"Invalid command or option provided to command help","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java","lineNumber":194,"sourceCode":"        }\n    }\n\n    public static void printHelp(String command)\n    {\n        Command cmd = Command.get(command);\n        if (cmd != null)\n        {\n            cmd.printHelp();\n            return;\n        }\n        CliOption opt = CliOption.get(command);\n        if (opt != null)\n        {\n            opt.printHelp();\n            return;\n        }\n        printHelp();\n        throw new IllegalArgumentException(\"Invalid command or option provided to command help\");\n    }\n\n    static Runnable helpHelpPrinter()\n    {\n        return () -> {\n            System.out.println(\"Usage: ./bin/cassandra-stress help <command|option>\");\n            System.out.println(\"Commands:\");\n            for (Command cmd : Command.values())\n                System.out.println(\"    \" + cmd.names.toString().replaceAll(\"\\\\[|\\\\]\", \"\"));\n            System.out.println(\"Options:\");\n            for (CliOption op : CliOption.values())\n                System.out.println(\"    -\" + toLowerCaseLocalized(op.toString()) + (op.extraName != null ? \", \" + op.extraName : \"\"));\n        };\n    }\n\n    static Runnable printHelpPrinter()\n    {\n        return () -> GroupedOptions.printOptions(System.out, \"print\", new GroupedOptions()","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java#L176-L212","documentation":"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.","triggerScenarios":"Running 'cassandra-stress help foo' where 'foo' is not a recognized command or option name (opt == null and cmd == null in printHelp).","commonSituations":"Typos ('cassandra-stress help inser'), asking for help on an option that belongs to another tool, or help names changed across Cassandra versions.","solutions":["Check the spelling against the list printed by 'cassandra-stress help'","Use 'help <command>' for commands (write, read, mixed, user) or 'help -<option>' for option groups (-rate, -log, -schema)","Run bare 'cassandra-stress help' to enumerate valid names for your version"],"exampleFix":"// before\ncassandra-stress help inser\n// after\ncassandra-stress help insert","handlingStrategy":"validation","validationCode":"Set<String> known = Set.of(\"write\",\"read\",\"mixed\",\"counter_write\",\"user\",\"-rate\",\"-log\",\"-schema\",\"-node\",\"-port\",\"-mode\");\nif (helpTopic != null && !known.contains(helpTopic)) System.out.println(\"unknown help topic: \" + helpTopic);","typeGuard":null,"tryCatchPattern":"try { printHelp(topic); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Invalid command or option\")) printGeneralHelp(); else throw e; }","preventionTips":["Spell-check the help topic against the general help listing","Commands and options are version-specific; check help output of your Cassandra version","Prefix options with '-' when asking for option help"],"tags":["cli","help","typo"],"backgroundTag":"command-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}