NationalSecurityAgency/ghidra · error · IllegalArgumentException

Invalid option use: --overwrite

Error message

Invalid option use: --overwrite

What it means

Thrown by doGenerateSigs() when --overwrite is supplied but no XML output directory is given (params is empty). When no directory is specified, BSim uses a temporary directory and commits directly, making --overwrite meaningless because temp dirs don't contain pre-existing files to overwrite. The guard at line 605 enforces this.

Source

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

		// 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
		}

		try (BulkSignatures bsim = getBulkSignatures()) {
			if (commitOption) {
				// Generate and commit signatures to BSim database
				bsim.signatureRepo(ghidraURL, xmlDirectory, overwriteOption, monitor);
			}
			else {
				// Generate sig XML files only
				bsim.generateSignaturesFromServer(ghidraURL, xmlDirectory, overwriteOption,
					configOption, monitor);
			}
		}
	}

	private void doGenerateUpdates(List<String> params, TaskMonitor monitor)

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Provide an explicit XML output directory if you want --overwrite to apply: generatesigs <ghidraURL> <xmldir> --bsim <url> --overwrite.
  2. Or remove --overwrite when committing without an explicit directory (the temp dir is always fresh).

Example fix

// before
bsim generatesigs ghidra://myhost/Repo --bsim postgresql://myhost/BsimDB --overwrite
// after
bsim generatesigs ghidra://myhost/Repo /tmp/xmlout --bsim postgresql://myhost/BsimDB --overwrite
Defensive patterns

Strategy: validation

Validate before calling

// --overwrite requires an explicit XML directory positional
boolean overwrite = booleanOptions.contains("--overwrite");
if (overwrite && positionalParams.isEmpty()) {
    throw new IllegalArgumentException("--overwrite requires an explicit XML output directory");
}

Prevention

When it happens

Trigger: Command: generatesigs <ghidraURL> --bsim <bsimURL> --overwrite (no positional XML dir). params.size() != 1, so the else branch at line 604 runs; overwriteOption is true, triggering line 606.

Common situations: Using --overwrite as a general 'force' flag without understanding it only applies to an explicit output directory; copying flags from a directory-based command into the temp-dir commit form.

Related errors


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