NationalSecurityAgency/ghidra · error · IllegalArgumentException

Missing required parameter ({}) before specified option: {}

Error message

Missing required parameter ({}) before specified option: {}

What it means

Thrown by checkRequiredParam() when the required positional parameter slot is occupied by a token that looks like an option (starts with '--' or contains '='). This means a required positional argument was omitted and the parser is seeing an option where it expected a value like a command name or URL.

Source

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

			}
			else {
				// consume next param as option value
				if (++i == params.length) {
					throw new IllegalArgumentException("Missing option value: " + optionName);
				}
				optionValueMap.put(option, params[i]);
			}
		}
		return subParams;
	}

	private void checkRequiredParam(String[] params, int index, String name) {
		if (params.length <= index) {
			throw new IllegalArgumentException("Missing required parameter: " + name);
		}
		String p = params[index];
		if (p.startsWith("--") || p.contains("=")) {
			throw new IllegalArgumentException(
				"Missing required parameter (" + name + ") before specified option: " + p);
		}
	}

	private Integer parsePositiveIntegerOption(String option) {
		String optionValue = optionValueMap.get(option);
		if (optionValue == null) {
			return null;
		}
		try {
			int value = Integer.valueOf(optionValue);
			if (value < 0) {
				throw new IllegalArgumentException("Negative value not permitted for " + option);
			}
			return value;
		}
		catch (NumberFormatException e) {
			throw new IllegalArgumentException("Invalid integer value specified for " + option);

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Place all required positional arguments (command, URL) before any -- options.
  2. Ensure the command name is the first argument and the URL is the second.
  3. Review wrapper scripts to confirm they emit arguments in the correct order.

Example fix

// before
bsim createdatabase --name MyDB h2://localhost/mybsimdb
// error: Missing required parameter (URL) before specified option: --name

// after
bsim createdatabase h2://localhost/mybsimdb --name MyDB
Defensive patterns

Strategy: validation

Validate before calling

// Ensure params[0] and params[1] are not options
for (int i = 0; i <= 1 && i < params.length; i++) {
    if (params[i].startsWith("--") || params[i].contains("=")) {
        throw new IllegalArgumentException(
            "Required positional parameter at index " + i + " is missing; found option: " + params[i]);
    }
}

Prevention

When it happens

Trigger: Running 'bsim createdatabase --user admin' where the URL (params[1]) slot is occupied by '--user'. Or 'bsim --config foo createdatabase' where the command (params[0]) slot is '--config'. The required positional parameter was skipped.

Common situations: Putting options before required positional arguments; a wrapper or alias that prepends options before the command; forgetting the URL between the command and the options.

Related errors


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