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 slot that should hold a required positional argument instead contains a '--' option token. This means an option appeared before a required positional was supplied, so the parser cannot fill the positional slot.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimControlLaunchable.java:361

			}
		}

		if (sawNoLocalAuth) {	// Turn off authentication for local connections
			authConfigPresent = true;
			localAuthentication = AUTHENTICATION_NONE;
		}
		if (connectingUserName == null) {
			connectingUserName = ClientUtil.getUserName();
		}
	}

	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("--")) {
			throw new IllegalArgumentException(
				"Missing required parameter (" + name + ") before specified option: " + p);
		}
	}

	private int parsePositiveIntegerOption(String option, String optionValue) {
		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. Move the required positional argument before the options.
  2. Keep the convention: positionals first, then --options.
  3. Use --help to confirm the expected positional order.

Example fix

// before
bsim control configure --port 5432 myhost
// after
bsim control configure myhost --port 5432
Defensive patterns

Strategy: validation

Validate before calling

// Required positionals must precede any --option token.
for (int i = 0; i < requiredPositionalCount; i++) {
    if (i < params.length && params[i].startsWith("--")) {
        System.err.println("Required positional #" + (i + 1) + " missing before option " + params[i]);
        return;
    }
}

Try / catch

try {
    launchable.checkRequiredParam(params, index, name);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Missing required parameter (")) {
        System.err.println("Put required positional arguments before the options.");
    }
    throw e;
}

Prevention

When it happens

Trigger: Placing options before a required positional, e.g. `bsim control configure --port 5432 myhost` where configure expects the host first (line 361).

Common situations: Reordering args so options come first, or assuming options can precede positionals like in some other CLIs.

Related errors


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