NationalSecurityAgency/ghidra · error · IllegalArgumentException
Extra argument '{key}'
Error message
Extra argument '{key}' What it means
Thrown by RemoteMethod.validate() when the supplied argument map contains a key that is not among the method's declared parameters. After validating declared parameters, the method iterates over all supplied entries and rejects any unknown key.
Source
Thrown at Ghidra/Debug/Debugger-api/src/main/java/ghidra/debug/api/tracermi/RemoteMethod.java:188
}
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);
}
for (Map.Entry<String, Object> ent : arguments.entrySet()) {
if (!parameters().containsKey(ent.getKey())) {
throw new IllegalArgumentException("Extra argument '" + ent.getKey() + "'");
}
}
return trace;
}
/**
* Invoke the remote method, getting a future result.
*
* <p>
* This invokes the method asynchronously. The returned objects is a {@link CompletableFuture},
* whose getters are overridden to prevent blocking the Swing thread for more than 1 second. Use
* of this method is not recommended, if it can be avoided; however, you should not create a
* thread whose sole purpose is to invoke this method. UI actions that need to invoke a remote
* method should do so using this method, but they must be sure to handle errors using, e.g.,
* using {@link CompletableFuture#exceptionally(Function)}, lest the actions fail silently.
*
* @param arguments the keyword arguments to the remote method
* @return the future resultView on GitHub (pinned to d5f144c24d)
Solutions
- Compare argument keys against method.parameters().keySet() and remove any unknown entries.
- Derive the argument map keys directly from the declared parameters rather than hardcoding strings.
- Log unknown keys at debug level before validate() to catch typos early.
Example fix
// before
method.validate(Map.of("target", obj, "trg", obj2)); // 'trg' is a typo
// after
Set<String> allowed = method.parameters().keySet();
args.keySet().retainAll(allowed);
method.validate(args); Defensive patterns
Strategy: validation
Validate before calling
// Remove unknown keys before validate:
Set<String> allowed = method.parameters().keySet();
Set<String> unknown = new HashSet<>(arguments.keySet());
unknown.removeAll(allowed);
if (!unknown.isEmpty()) {
throw new IllegalStateException("Unknown keys: " + unknown);
} Try / catch
try {
method.validate(arguments);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Extra argument")) {
arguments.keySet().retainAll(method.parameters().keySet());
} else throw e;
} Prevention
- Build argument maps from parameters().keySet() to avoid typos.
- Log any unknown keys at debug level before invoking.
When it happens
Trigger: Calling validate(arguments) where arguments has a key not present in remoteMethod.parameters().
Common situations: Typos in argument keys; passing arguments meant for a different method version; stale keys left over after refactoring method signatures.
Related errors
- Missing required parameter '{key}'
- Missing required parameter '%s' (%s)
- For parameter %s: argument %s is not a %s
- All TraceObject parameters must come from the same trace
- length < 0
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/7d18e0ef505f2a9a.
Report an issue: GitHub.