xai-org/grok-build · warning · acp::Error
-32602
-32602
Error message
Invalid params: {e} What it means
In handle_mcp_elicit, the ext.request.params string is deserialized into McpElicitExtRequest; on parse failure the handler logs the error and replies with a JSON-RPC -32602 (InvalidParams) error containing the serde message. The interaction is then aborted (returns false) rather than proceeding to target the agent.
Source
Thrown at crates/codegen/xai-grok-pager/src/app/acp_handler/interactions.rs:25
let cancelled = xai_grok_tools::mcp_elicitation::McpElicitExtResponse::Cancel;
if let Ok(raw) = serde_json::value::to_raw_value(&cancelled) {
response_tx.send(Ok(acp::ExtResponse::new(raw.into()))).ok();
}
}
pub(crate) fn handle_mcp_elicit(
ext: xai_acp_lib::AcpArgs<acp::ExtRequest>,
app: &mut AppView,
) -> bool {
use crate::views::elicitation_view::ElicitationViewState;
use xai_grok_tools::mcp_elicitation::McpElicitExtRequest;
let ext_req: McpElicitExtRequest = match serde_json::from_str(ext.request.params.get()) {
Ok(r) => r,
Err(e) => {
tracing::error!(error = %e, "Failed to parse McpElicitExtRequest");
ext.response_tx
.send(Err(acp::Error::new(-32602, format!("Invalid params: {e}"))))
.ok();
return false;
}
};
let Some(id) = interaction_target_agent(app, &ext_req.session_id) else {
tracing::info!(
session_id = %ext_req.session_id,
"mcp elicit for a session with no local view; parked for leader replay-on-attach"
);
drop(ext.response_tx);
return false;
};
let is_active = is_matched_agent_active(app, id);
let Some(agent) = app.agents.get_mut(&id) else {
drop(ext.response_tx);
return false;
};View on GitHub (pinned to bc7f02eddd)
Solutions
- Validate and correct the client's params JSON against McpElicitExtRequest (required session_id etc.)
- Align client and server versions so the elicit request schema matches
- Log the serde error ({e}) to see exactly which field failed and fix it
- Add client-side validation before sending the extension request
Example fix
// before
let params = json!({ "sessionId": id }); // wrong field name
acp.extMethod("mcp_elicit", params)?;
// after
let params = json!({ "session_id": id });
acp.extMethod("mcp_elicit", params)?; Defensive patterns
Strategy: validation
Validate before calling
fn validate_elicit_params(raw: &str) -> Result<(), String> {
serde_json::from_str::<McpElicitExtRequest>(raw)
.map(|_| ())
.map_err(|e| format!("Invalid params: {e}"))
} Try / catch
match serde_json::from_str::<McpElicitExtRequest>(params) {
Err(e) => return Err(acp::Error::new(-32602, format!("Invalid params: {e}"))),
Ok(req) => handle(req),
} Prevention
- Validate params against McpElicitExtRequest's schema client-side
- Keep client/server versions aligned on the elicit request shape
- Include the serde error text in logs to pinpoint bad fields
- Add round-trip tests for the extension request serialization
When it happens
Trigger: Calling the mcp/elicit ACP extension method with params that are not valid JSON or do not match McpElicitExtRequest's schema (missing/misspelled fields like session_id, wrong types).
Common situations: Clients sending older/newer param shapes than the handler expects; JSON-encoded payloads double-quoted or truncated; schema drift after a version bump.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Invalid ACP content blocks: {e}
- Invalid ACP content blocks in "content": {e}
- failed to build request: {e}
- response parse error: {e}
- ACP response missing result field
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/ddb5202e31cfc136.
Report an issue: GitHub.