NationalSecurityAgency/ghidra · error · IllegalArgumentException

Missing database template

Error message

Missing database template

What it means

Thrown by doCreateDatabase() when the positional params list (after the bsimURL is consumed) is empty. The createdatabase command requires a config template name as its second positional argument (large_32, medium_32, medium_64, medium_cpool, medium_nosize) to define the BSim database's signature characteristics. Without it, the database schema cannot be determined.

Source

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

	/**
	 * 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
	 */
	public void run(String[] params) throws Exception {
		run(params, TaskMonitor.DUMMY);
	}

	/**
	 * Creates a new BSim database with a given set of properties.
	 * 
	 * @param params the command-line parameters
	 * @throws IOException if there's an error establishing the database connection
	 */
	private void doCreateDatabase(List<String> params) throws IOException {
		if (params.isEmpty()) {
			throw new IllegalArgumentException("Missing database template");
		}
		else if (params.size() > 1) {
			throw new IllegalArgumentException("Unexpected parameter: " + params.get(1));
		}

		String configTemplate = params.get(0);
		boolean noTrackCallGraph = booleanOptions.contains(NO_CALLGRAPH_OPTION);

		String nameOption = optionValueMap.get(NAME_OPTION);
		String ownerOption = optionValueMap.get(OWNER_OPTION);
		String descOption = optionValueMap.get(DESCRIPTION_OPTION);

		try (BulkSignatures bsim = getBulkSignatures()) {
			bsim.createDatabase(configTemplate, nameOption, ownerOption, descOption,
				!noTrackCallGraph);
		}
	}

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Append a config template name: one of large_32, medium_32, medium_64, medium_cpool, medium_nosize.
  2. Run 'bsim' with no args to see the usage line for createdatabase (line 1024) and the enumerated templates (line 1052).
  3. If scripting, validate the template is non-empty before invoking run().

Example fix

// before
bsim createdatabase postgresql://myhost/BsimDB
// after
bsim createdatabase postgresql://myhost/BsimDB medium_64
Defensive patterns

Strategy: validation

Validate before calling

// Before run(): confirm the createdatabase command has a template positional
// params[0]="createdatabase", params[1]=bsimURL, params[2] must be a template
if ("createdatabase".equals(params[0]) && params.length < 3) {
    throw new IllegalArgumentException("createdatabase requires a config template: large_32|medium_32|medium_64|medium_cpool|medium_nosize");
}

Prevention

When it happens

Trigger: Running 'bsim createdatabase <bsimURL>' with no template argument. checkRequiredParam at index 1 validates the URL, then readOptions returns an empty subParams list, so params.isEmpty() is true at line 533.

Common situations: Forgetting the template is mandatory; confusing the order (template must come after bsimURL); copy-pasting an example that omitted the template; misspelling a known template so readOptions treats it as an option prefix.

Related errors


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