{"record":{"id":"7200698c2eaafc7d","repo":"NationalSecurityAgency/ghidra","slug":"unsupported-command","errorCode":null,"errorMessage":"Unsupported command: {}","messagePattern":"Unsupported command: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java","lineNumber":250,"sourceCode":"\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);\n\t\tif (allowedParams == null) {\n\t\t\tthrow new IllegalArgumentException(\"Unsupported command: \" + command);\n\t\t}\n\n\t\tfor (int i = discard; i < params.length; ++i) {\n\t\t\tString optionName = params[i];\n\t\t\tString value = null;\n\n\t\t\tif (optionName.startsWith(\"-\")) {\n\t\t\t\t// although not prefered, allow option value to be specified as --option=value\n\t\t\t\tint ix = optionName.indexOf(\"=\");\n\t\t\t\tif (ix > 1) {\n\t\t\t\t\tvalue = optionName.substring(ix + 1);\n\t\t\t\t\toptionName = optionName.substring(0, ix);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tString option = optionName;\n\n\t\t\tif (optionName.startsWith(\"-\") && !optionName.startsWith(\"--\")) {","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java#L232-L268","documentation":"Thrown by readOptions() when the command (subcommand) name passed to the BSim control launchable has no entry in ALLOWED_OPTION_MAP. The tool only accepts a fixed set of registered subcommands, and this check runs before any option parsing, so an unrecognized command is rejected immediately.","triggerScenarios":"Invoking the launchable with a command string that is not a key in ALLOWED_OPTION_MAP (e.g. `bsim control star` or `bsim control <typo>`). The lookup `ALLOWED_OPTION_MAP.get(command)` returns null and the exception fires at line 250.","commonSituations":"Typo in the subcommand, using a command name renamed/removed in a newer Ghidra version, copy-pasting from outdated docs, or accidentally placing a global option where the subcommand token is expected.","solutions":["Run the tool with --help (or inspect the usage) to list the supported subcommands.","Compare your command spelling against the keys registered in ALLOWED_OPTION_MAP in BSimControlLaunchable.java.","Make sure the subcommand is the first positional token, before any --options.","Confirm you are on a Ghidra version where that subcommand still exists."],"exampleFix":"// before\nbsim control star\n// after\nbsim control start","handlingStrategy":"validation","validationCode":"// Validate the subcommand against the known set before launching.\nSet<String> known = Set.of(\"configure\", \"start\", \"stop\", \"status\", \"adduser\", \"upgrade\", \"list\");\nif (!known.contains(command)) {\n    System.err.println(\"Unknown command: \" + command + \". Valid: \" + known);\n    printUsage();\n    return;\n}\nlaunchable.execute(args);","typeGuard":null,"tryCatchPattern":"try {\n    launchable.execute(args);\n} catch (IllegalArgumentException e) {\n    // message starts with \"Unsupported command:\"\n    System.err.println(e.getMessage());\n    printAvailableCommands();\n}","preventionTips":["Centralize the allowed-command list and reuse it for both validation and help output.","Always emit --help / usage when rejecting a command so the user sees valid options.","Treat the first positional token as the subcommand and validate before option parsing."],"tags":["cli","argument-validation","bsim"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}