NationalSecurityAgency/ghidra · error · IllegalArgumentException
Unknown command: {}
Error message
Unknown command: {} What it means
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.
Source
Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:230
scanDataDirectory(params, slot++);
scanUsername(params, slot++);
break;
case COMMAND_DROPUSER:
scanDataDirectory(params, slot++);
scanUsername(params, slot++);
break;
case COMMAND_RESET_PASSWORD:
scanUsername(params, slot++);
break;
case COMMAND_CHANGEAUTH:
scanDataDirectory(params, slot++);
break;
case COMMAND_CHANGE_PRIVILEGE:
scanUsername(params, slot++);
scanPrivilege(params, slot++);
break;
default:
throw new IllegalArgumentException("Unknown command: " + command);
}
readOptions(command, params, slot);
return command;
}
/**
* Read in any optional parameters, strip them from the parameter stream
* @param command command name
* @param params is the original array of command line parameters
* @param discard number of params already consumed
*/
private void readOptions(String command, String[] params, int discard) {
boolean sawNoLocalAuth = false;
Set<String> allowedParams = ALLOWED_OPTION_MAP.get(command);View on GitHub (pinned to d5f144c24d)
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).
Example fix
# before $ bsimctl creatdb myhost/db # typo # # after $ bsimctl createdb myhost/db # correct command name
Defensive patterns
Strategy: validation
Validate before calling
// Validate command before dispatch
Set<String> valid = Set.of("add", "drop", "create", "list" /* ... */);
if (!valid.contains(command.toLowerCase())) {
System.err.println("Unknown command: " + command + "\nValid commands: " + valid);
return;
} Try / catch
try {
// parse and dispatch command
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unknown command")) {
// print usage/help and exit gracefully
printUsage();
} else {
throw e;
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported command: {}
- Unsupported option use: {}
- Unexpected argument: {}
- Unsupported option specification: {}=
- Missing option value: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/1911035a14e9dbc7.
Report an issue: GitHub.