xpipe-io/xpipe · error · BeaconClientException
Missing argument for key " + key
Error message
Missing argument for key " + key
What it means
McpToolHandler.getStringArgument requires a string-typed tool argument under the given key. When the MCP tool call request carries no arguments map at all (arguments() == null), no value can be retrieved, so it throws BeaconClientException.
Source
Thrown at app/src/main/java/io/xpipe/app/beacon/mcp/McpToolHandler.java:85
return request;
}
public Optional<String> getOptionalStringArgument(String key) {
var o = request.arguments().get(key);
if (o == null) {
return Optional.empty();
}
if (!(o instanceof String s) || s.isBlank()) {
return Optional.empty();
}
return Optional.of(s);
}
public String getStringArgument(String key) throws BeaconClientException {
if (request.arguments() == null) {
throw new BeaconClientException("Missing argument for key " + key);
}
var o = request.arguments().get(key);
if (o == null) {
throw new BeaconClientException("Missing argument for key " + key);
}
if (!(o instanceof String s) || s.isBlank()) {
throw new BeaconClientException("Invalid argument for key " + key);
}
return s;
}
public Optional<Boolean> getOptionalBooleanArgument(String key) {
var o = request.arguments().get(key);
if (o == null) {
return Optional.empty();View on GitHub (pinned to d85ca821ba)
Solutions
- Include the required key in the tool call's arguments object
- Use getOptionalStringArgument for optional parameters
- Client-side: validate required tool input against the tool's inputSchema before invoking
- Return the tool's input schema requirement in the tool description so clients send it
Example fix
// before
handler.getStringArgument("connection"); // arguments == null
// after
var conn = handler.getOptionalStringArgument("connection").orElseThrow(
() -> new IllegalArgumentException("'connection' is required")); Defensive patterns
Strategy: validation
Validate before calling
if (toolCall.arguments() == null || toolCall.arguments().get("connection") == null) {
throw new IllegalArgumentException("'connection' argument required");
} Try / catch
try {
String v = handler.getStringArgument(key);
} catch (BeaconClientException ex) {
if (ex.getMessage().contains("Missing argument")) {
// reply to the MCP client with an input-schema error
} else throw ex;
} Prevention
- Declare required properties with required[] in the tool's inputSchema
- Use optional getters for non-mandatory params
- Send an explicit arguments object even if mostly empty
When it happens
Trigger: An MCP client invoking a tool without sending any 'arguments' object while the tool handler calls getStringArgument for a required parameter.
Common situations: Client omits the arguments object entirely for a no-thought invocation; hand-crafted JSON-RPC calls missing 'arguments'; older MCP clients not sending optional fields.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Invalid argument for key " + key
- Not a shell connection
- Unable to parse store data into valid store
- Category with id " + msg.getCategory() + " does not exist
- No connection found for input " + msg.getConnection()
AI-assisted analysis of xpipe-io/xpipe@d85ca821ba (2026-09-06).
Data as JSON: /api/errors/70713ab314e846d8.
Report an issue: GitHub.