NationalSecurityAgency/ghidra · warning · IllegalArgumentException

Invalid integer value specified for {}

Error message

Invalid integer value specified for {}

What it means

Thrown by parsePositiveIntegerOption() when the option value cannot be parsed as an integer (Integer.valueOf throws NumberFormatException). The catch block wraps it in an IllegalArgumentException. The value is non-numeric or contains invalid characters.

Source

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

			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);
		}
	}

	/**
	 * Runs the command specified by the given set of params.
	 * 
	 * @param params the parameters specifying the command
	 * @param monitor the task monitor
	 * @throws IllegalArgumentException if invalid params have been specified
	 * @throws Exception if there's an error during the operation
	 * @throws CancelledException if processing is cancelled
	 */
	public void run(String[] params, TaskMonitor monitor) throws Exception, CancelledException {

		clearParams();

		checkRequiredParam(params, 0, "command");
		String command = params[0];

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Provide a valid non-negative integer value.
  2. Ensure no whitespace, commas, or decimal points are in the value.
  3. If the value comes from a variable, validate it is numeric before passing to BSim.

Example fix

// before
bsim listexes h2://localhost/db --limit abc
// error: Invalid integer value specified for --limit

// after
bsim listexes h2://localhost/db --limit 50
Defensive patterns

Strategy: type-guard

Validate before calling

String limitStr = optionValueMap.get("--limit");
if (limitStr != null) {
    try {
        Integer.parseInt(limitStr);
    } catch (NumberFormatException e) {
        throw new IllegalArgumentException("--limit value '" + limitStr + "' is not a valid integer");
    }
}

Type guard

private static boolean isNonNegativeInteger(String value) {
    if (value == null) return false;
    try {
        return Integer.parseInt(value) >= 0;
    } catch (NumberFormatException e) {
        return false;
    }
}

Prevention

When it happens

Trigger: Specifying a non-numeric value for a numeric option, e.g., '--limit abc', '--maxfunc=xyz', or '--limit 1.5' (floats are not accepted, only integers).

Common situations: Typo in the numeric value; passing a string identifier instead of a number; using a float where an integer is required; locale-specific number formatting with commas or periods.

Related errors


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