NationalSecurityAgency/ghidra · error · IllegalArgumentException

Invalid generatesigs parameter use!

Error message

Invalid generatesigs parameter use!

What it means

Thrown by doGenerateSigs() when more than one positional argument is passed. The generatesigs command accepts at most one positional: an optional XML output directory. Two or more positional tokens after the ghidraURL indicate the user has misunderstood the command syntax. Note that concurrent --bsim/--config conflicts are already caught earlier in processSigAndUpdateOptions().

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ingest/BSimLaunchable.java:590

		Console cons = System.console();
		if (cons == null) {
			System.out.println("Could not acquire console");
			return false;
		}
		System.out.print("Are you sure you want to drop the database? (y/n): ");
		String input = cons.readLine();
		if (input.equalsIgnoreCase("y")) {
			return true;
		}
		System.out.println("Database NOT dropped");
		return false;
	}

	private void doGenerateSigs(List<String> params, TaskMonitor monitor)
			throws Exception, CancelledException {
		// concurrent --bsim and --config option use already checked
		if (params.size() > 1) {
			throw new IllegalArgumentException("Invalid generatesigs parameter use!");
		}
		boolean commitOption = booleanOptions.contains(COMMIT_OPTION);
		boolean overwriteOption = booleanOptions.contains(OVERWRITE_OPTION);
		String configOption = optionValueMap.get(CONFIG_OPTION);

		String xmlDirectory = null;
		if (params.size() == 1) {
			xmlDirectory = params.get(0);
			if (configOption != null && commitOption) {
				throw new IllegalArgumentException(
					"Invalid option use with " + CONFIG_OPTION + " option: " + COMMIT_OPTION);
			}
		}
		else {
			if (overwriteOption) {
				throw new IllegalArgumentException("Invalid option use: " + OVERWRITE_OPTION);
			}
			commitOption = true; // assume DB commit using temp XML directory

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Ensure at most one positional XML directory argument follows the ghidraURL.
  2. Move any template specification to --config <template> rather than a bare positional.
  3. Review the three valid generatesigs forms in printUsage() at lines 1033-1035.

Example fix

// before
bsim generatesigs ghidra://myhost/Repo /tmp/out medium_64
// after
bsim generatesigs ghidra://myhost/Repo /tmp/out --config medium_64
Defensive patterns

Strategy: validation

Validate before calling

// For generatesigs: positional count must be 0 or 1
if ("generatesigs".equals(command) && positionalParams.size() > 1) {
    throw new IllegalArgumentException("generatesigs accepts at most one XML directory positional");
}

Prevention

When it happens

Trigger: Running generatesigs with two or more bare positional tokens, e.g. 'generatesigs <ghidraURL> dir1 dir2'. params.size() > 1 at line 589.

Common situations: Specifying both a source and output directory when only output is expected; passing a config template as a positional instead of via --config; a quoted path that the shell split into two tokens.

Related errors


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