NationalSecurityAgency/ghidra · error · IllegalArgumentException

Extraneous parameters: {extraneous}

Error message

Extraneous parameters: {extraneous}

What it means

Thrown as IllegalArgumentException by LaunchParameter.validateArguments (LaunchParameter.java:60-64) when the supplied arguments map contains keys not present in the declared LaunchParameter set. The extraneous keys are collected into a sorted TreeSet and reported. This runs before type checking, so extraneous names always fail first.

Source

Thrown at Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/LaunchParameter.java:63

	public static Map<String, LaunchParameter<?>> mapOf(Collection<LaunchParameter<?>> parameters) {
		Map<String, LaunchParameter<?>> result = new LinkedHashMap<>();
		for (LaunchParameter<?> param : parameters) {
			LaunchParameter<?> exists = result.put(param.name(), param);
			if (exists != null) {
				throw new IllegalArgumentException(
					"Duplicate names in parameter map: first=%s, second=%s".formatted(exists,
						param));
			}
		}
		return Collections.unmodifiableMap(result);
	}

	public static Map<String, ValStr<?>> validateArguments(
			Map<String, LaunchParameter<?>> parameters, Map<String, ValStr<?>> arguments) {
		if (!parameters.keySet().containsAll(arguments.keySet())) {
			Set<String> extraneous = new TreeSet<>(arguments.keySet());
			extraneous.removeAll(parameters.keySet());
			throw new IllegalArgumentException("Extraneous parameters: " + extraneous);
		}

		Map<String, String> typeErrors = null;
		for (Map.Entry<String, ValStr<?>> ent : arguments.entrySet()) {
			String name = ent.getKey();
			ValStr<?> val = ent.getValue();
			LaunchParameter<?> param = parameters.get(name);
			if (val.val() != null && !param.type.isAssignableFrom(val.val().getClass())) {
				if (typeErrors == null) {
					typeErrors = new LinkedHashMap<>();
				}
				typeErrors.put(name, "val '%s' is not a %s".formatted(val.val(), param.type()));
			}
		}
		if (typeErrors != null) {
			throw new IllegalArgumentException("Type errors: " + typeErrors);
		}
		return arguments;

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Remove the extraneous argument keys listed in the error from the arguments map.
  2. Cross-check argument keys against the launcher's declared LaunchParameter names.
  3. Update the declared parameters (or the caller) so the key sets agree after a schema change.

Example fix

// before
validateArguments(
  Map.of("image", pImage),                 // declared
  Map.of("image", vImage, "img", vExtra)); // 'img' not declared -> Extraneous

// after
validateArguments(
  Map.of("image", pImage),
  Map.of("image", vImage));
Defensive patterns

Strategy: validation

Validate before calling

Set<String> unknown = new TreeSet<>(arguments.keySet());
unknown.removeAll(parameters.keySet());
if (!unknown.isEmpty()) {
    throw new IllegalArgumentException("Remove unknown args: " + unknown);
}

Type guard

boolean argsAreSubset(Map<String,?> params, Map<String,?> args) {
    return params.keySet().containsAll(args.keySet());
}

Try / catch

try {
    LaunchParameter.validateArguments(parameters, arguments);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Extraneous parameters")) {
        arguments.keySet().retainAll(parameters.keySet());
        LaunchParameter.validateArguments(parameters, arguments);
    } else throw e;
}

Prevention

When it happens

Trigger: Calling validateArguments(parameters, arguments) where arguments.keySet() is not a subset of parameters.keySet(): e.g. passing an option the launcher does not declare, or a renamed parameter after a schema change.

Common situations: A launcher configuration/launch.properties entry referencing a parameter name that was removed or renamed; a typo in an argument key; passing UI-collected fields that no longer match the launcher's declared parameters.

Related errors


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