NationalSecurityAgency/ghidra · error · IllegalArgumentException

Missing required parameter '{key}'

Error message

Missing required parameter '{key}'

What it means

Thrown by RemoteMethod.validate() when an argument map is missing a parameter that is declared required()=true. This is the validate()-path counterpart to the typed get() in LaunchParameter. validate() iterates over the method's declared parameters and checks each argument for presence and type.

Source

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

	/**
	 * Validate the given argument.
	 * 
	 * <p>
	 * This method is for checking parameter sanity before they are marshalled to the back-end. This
	 * is called automatically during invocation. Clients can use this method to pre-test or
	 * validate in the UI, when invocation is not yet desired.
	 * 
	 * @param arguments the arguments
	 * @return the trace if any object arguments were given, or null
	 * @throws IllegalArgumentException if the arguments are not valid
	 */
	default Trace validate(Map<String, Object> arguments) {
		Trace trace = null;
		SchemaContext ctx = PrimitiveTraceObjectSchema.MinimalSchemaContext.INSTANCE;
		for (Map.Entry<String, RemoteParameter> ent : parameters().entrySet()) {
			if (!arguments.containsKey(ent.getKey())) {
				if (ent.getValue().required()) {
					throw new IllegalArgumentException(
						"Missing required parameter '" + ent.getKey() + "'");
				}
				continue; // Should not need to check the default value
			}
			Object arg = arguments.get(ent.getKey());
			if (arg instanceof TraceObject obj) {
				if (trace == null) {
					trace = obj.getTrace();
					ctx = trace.getObjectManager().getRootSchema().getContext();
				}
				else if (trace != obj.getTrace()) {
					throw new IllegalArgumentException(
						"All TraceObject parameters must come from the same trace");
				}
			}
			SchemaName schName = ent.getValue().type();
			TraceObjectSchema sch = ctx.getSchemaOrNull(schName);
			checkType(ent.getKey(), schName, sch, arg);

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Inspect the method's parameters() map and include every parameter where required() is true.
  2. Call validate() early during form/argument construction to surface missing keys before invocation.
  3. Use the parameter default values for optional ones instead of omitting them.

Example fix

// before
method.validate(Map.of("x", val)); // 'y' is required but omitted

// after
Map<String,Object> args = new HashMap<>();
args.put("x", val);
args.put("y", yVal);
method.validate(args);
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate required keys:
Set<String> requiredKeys = method.parameters().entrySet().stream()
    .filter(e -> e.getValue().required())
    .map(Map.Entry::getKey)
    .collect(Collectors.toSet());
if (!arguments.keySet().containsAll(requiredKeys)) {
    requiredKeys.removeAll(arguments.keySet());
    throw new IllegalStateException("Missing: " + requiredKeys);
}

Try / catch

try {
    method.validate(arguments);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Missing required parameter")) {
        // collect the missing key and request it from the user
    } else throw e;
}

Prevention

When it happens

Trigger: Calling remoteMethod.validate(arguments) where arguments does not contain a key whose RemoteParameter.required() returns true.

Common situations: Pre-testing arguments in UI code before invoking a debugger remote method; constructing the argument map programmatically and forgetting a mandatory key.

Related errors


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