{"record":{"id":"1911035a14e9dbc7","repo":"NationalSecurityAgency/ghidra","slug":"unknown-command","errorCode":null,"errorMessage":"Unknown command: {}","messagePattern":"Unknown command: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java","lineNumber":230,"sourceCode":"\t\t\t\tscanDataDirectory(params, slot++);\n\t\t\t\tscanUsername(params, slot++);\n\t\t\t\tbreak;\n\t\t\tcase COMMAND_DROPUSER:\n\t\t\t\tscanDataDirectory(params, slot++);\n\t\t\t\tscanUsername(params, slot++);\n\t\t\t\tbreak;\n\t\t\tcase COMMAND_RESET_PASSWORD:\n\t\t\t\tscanUsername(params, slot++);\n\t\t\t\tbreak;\n\t\t\tcase COMMAND_CHANGEAUTH:\n\t\t\t\tscanDataDirectory(params, slot++);\n\t\t\t\tbreak;\n\t\t\tcase COMMAND_CHANGE_PRIVILEGE:\n\t\t\t\tscanUsername(params, slot++);\n\t\t\t\tscanPrivilege(params, slot++);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new IllegalArgumentException(\"Unknown command: \" + command);\n\t\t}\n\n\t\treadOptions(command, params, slot);\n\n\t\treturn command;\n\t}\n\n\t/**\n\t * Read in any optional parameters, strip them from the parameter stream\n\t * @param command command name\n\t * @param params is the original array of command line parameters\n\t * @param discard number of params already consumed\n\t */\n\tprivate void readOptions(String command, String[] params, int discard) {\n\n\t\tboolean sawNoLocalAuth = false;\n\n\t\tSet<String> allowedParams = ALLOWED_OPTION_MAP.get(command);","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L212-L248","documentation":"BSimControlLaunchable parses the first command-line argument as a BSim command enum. If the argument doesn't match any known COMMAND_* case, the switch falls through to default and throws IllegalArgumentException. This is a CLI argument parsing error indicating an unrecognized or misspelled command.","triggerScenarios":"Running the BSim control tool (bsimctl) where the first argument doesn't match any defined COMMAND_* constant (e.g., add, drop, create, etc.). The switch/case in the command parser hits default.","commonSituations":"Typo in the command name (e.g., 'creat' instead of 'create'); using a command from a different BSim version that doesn't exist in the current build; passing options/flags before the command; case sensitivity (commands may be case-sensitive); user unfamiliar with available commands passes an invalid one.","solutions":["Check the available commands by running the tool with --help or no arguments.","Correct the command spelling — common commands include create, add, drop, list, etc.","Ensure the command is the first positional argument, not preceded by flags.","Verify the command exists in your BSim version (newer/older versions may have different command sets)."],"exampleFix":"# before\n$ bsimctl creatdb myhost/db  # typo\n#\n# after\n$ bsimctl createdb myhost/db  # correct command name","handlingStrategy":"validation","validationCode":"// Validate command before dispatch\nSet<String> valid = Set.of(\"add\", \"drop\", \"create\", \"list\" /* ... */);\nif (!valid.contains(command.toLowerCase())) {\n    System.err.println(\"Unknown command: \" + command + \"\\nValid commands: \" + valid);\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    // parse and dispatch command\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown command\")) {\n        // print usage/help and exit gracefully\n        printUsage();\n    } else {\n        throw e;\n    }\n}","preventionTips":["Run the tool with --help or no args to list valid commands before use.","Place the command as the first positional argument (before flags).","Watch for typos and case-sensitivity in command names.","Verify the command exists in your installed BSim version."],"tags":["bsim","cli","command-parsing","argument-validation"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}