NationalSecurityAgency/ghidra · error · IllegalArgumentException

--bsim and --config options may not both be present

Error message

--bsim and --config options may not both be present

What it means

Thrown by processSigAndUpdateOptions() when both --bsim and --config options are present in the same invocation. These are mutually exclusive: --config reads both the ghidra source and BSim target from a configuration file, while --bsim specifies the BSim URL directly (with the ghidra URL inferred from the positional URL argument). Specifying both creates an ambiguous configuration.

Source

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

			bsimURL = BSimClientFactory.deriveBSimURL(urlstring);
			doGetCount(subParams);
		}
		else if (COMMAND_DUMP_SIGS.equals(command)) {
			bsimURL = BSimClientFactory.deriveBSimURL(urlstring);
			doDumpSigs(subParams);
		}
		else {
			throw new IllegalArgumentException("Unknown command: " + command);
		}
	}

	private void processSigAndUpdateOptions(String urlstring)
			throws IllegalArgumentException, MalformedURLException, URISyntaxException {
		String bsimURLOption = optionValueMap.get(BSIM_URL_OPTION);
		String configOption = optionValueMap.get(CONFIG_OPTION);
		if (configOption != null) {
			if (bsimURLOption != null) {
				throw new IllegalArgumentException(
					BSIM_URL_OPTION + " and " + CONFIG_OPTION + " options may not both be present");
			}
			setupGhidraURL(urlstring);
		}
		else if (bsimURLOption != null) {
			setupURLs(urlstring, bsimURLOption);
		}
		else {
			throw new IllegalArgumentException(
				"Must specify either " + BSIM_URL_OPTION + " or " + CONFIG_OPTION + " option");
		}
	}

	/**
	 * Runs the command specified by the given set of params.
	 * 
	 * @param params the parameters specifying the command
	 * @throws Exception when initializing the application or executing the command

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Choose one configuration method: either --config <file> or --bsim <url>, not both.
  2. If using --config, ensure the config file specifies the BSim target URL; remove the --bsim option.
  3. If using --bsim, provide the ghidra repository URL as the positional argument; remove the --config option.

Example fix

// before
bsim generatesigs ghidra://server/Repo --config myconfig.xml --bsim h2://localhost/db
// error: --bsim and --config options may not both be present

// after (option A: use --bsim)
bsim generatesigs ghidra://server/Repo --bsim h2://localhost/db

// after (option B: use --config)
bsim generatesigs ghidra://server/Repo --config myconfig.xml
Defensive patterns

Strategy: validation

Validate before calling

if (optionValueMap.containsKey("--bsim") && optionValueMap.containsKey("--config")) {
    throw new IllegalArgumentException(
        "Specify either --bsim or --config, not both.");
}

Prevention

When it happens

Trigger: Running 'generatesigs' or 'generateupdates' with both options, e.g., 'bsim generatesigs ghidra://server/Repo --config myconfig.xml --bsim h2://localhost/db'. The code detects both in optionValueMap and rejects immediately.

Common situations: Copy-pasting options from a previous run without removing the conflicting one; transitioning from --config-based to --bsim-based invocations and leaving the old option; misunderstanding that the two are alternative configuration mechanisms.

Related errors


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