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

  1. Check the available commands by running the tool with --help or no arguments.
  2. Correct the command spelling — common commands include create, add, drop, list, etc.
  3. Ensure the command is the first positional argument, not preceded by flags.
  4. 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

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


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/1911035a14e9dbc7. Report an issue: GitHub.