{"record":{"id":"c6238630591e928a","repo":"apache/cassandra","slug":"invalid-command-option-provided-to-help","errorCode":null,"errorMessage":"Invalid command/option provided to help","messagePattern":"Invalid command/option provided to help","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java","lineNumber":127,"sourceCode":"                if (clArgs.size() == 1)\n                {\n                    String p = clArgs.keySet().iterator().next();\n                    if (clArgs.get(p).length == 0)\n                        params = new String[]{ p };\n                }\n            }\n            else\n            {\n                printHelp();\n                return true;\n            }\n        }\n        if (params.length == 1)\n        {\n            printHelp(params[0]);\n            return true;\n        }\n        throw new IllegalArgumentException(\"Invalid command/option provided to help\");\n    }\n\n    private static boolean maybePrintVersion(Map<String, String[]> clArgs)\n    {\n        if (clArgs.containsKey(\"version\"))\n        {\n            try\n            {\n                URL url = Resources.getResource(\"org/apache/cassandra/config/version.properties\");\n                System.out.println(parseVersionFile(Resources.toString(url, Charsets.UTF_8)));\n            }\n            catch (IOException e)\n            {\n                e.printStackTrace(System.err);\n            }\n            return true;\n        }\n        return false;","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMisc.java#L109-L145","documentation":"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.","triggerScenarios":"Invoking 'cassandra-stress help <a> <b>' with two or more tokens after 'help', i.e. params.length > 1 in maybePrintHelp.","commonSituations":"Typing 'help read write' trying to see help for two commands at once, or accidentally passing extra flags after help.","solutions":["Pass only one command or option name after help: 'help read' or 'help -rate'","Run 'cassandra-stress help' with no arguments to list all commands and options","Request help for each item in a separate invocation"],"exampleFix":"// before\ncassandra-stress help read write\n// after\ncassandra-stress help read\ncassandra-stress help write","handlingStrategy":"validation","validationCode":"String[] rest = clArgs.get(\"help\");\nif (rest != null && rest.length > 1)\n    throw new IllegalArgumentException(\"help takes at most one command/option\");","typeGuard":null,"tryCatchPattern":"try { runStress(args); } catch (IllegalArgumentException e) { if (e.getMessage().equals(\"Invalid command/option provided to help\")) printUsageAndExit(); else throw e; }","preventionTips":["Pass exactly one topic after help","Loop over topics in separate invocations if you need help for several","Use bare 'help' to discover valid names first"],"tags":["cli","help","argument-count"],"backgroundTag":"invalid-cli-argument","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"}