{"record":{"id":"ddb5202e31cfc136","repo":"xai-org/grok-build","slug":"32602","errorCode":"-32602","errorMessage":"Invalid params: {e}","messagePattern":"Invalid params: (.+?)","errorType":"error_code","errorClass":"acp::Error","httpStatus":null,"severity":"warning","filePath":"crates/codegen/xai-grok-pager/src/app/acp_handler/interactions.rs","lineNumber":25,"sourceCode":"    let cancelled = xai_grok_tools::mcp_elicitation::McpElicitExtResponse::Cancel;\n    if let Ok(raw) = serde_json::value::to_raw_value(&cancelled) {\n        response_tx.send(Ok(acp::ExtResponse::new(raw.into()))).ok();\n    }\n}\n\npub(crate) fn handle_mcp_elicit(\n    ext: xai_acp_lib::AcpArgs<acp::ExtRequest>,\n    app: &mut AppView,\n) -> bool {\n    use crate::views::elicitation_view::ElicitationViewState;\n    use xai_grok_tools::mcp_elicitation::McpElicitExtRequest;\n\n    let ext_req: McpElicitExtRequest = match serde_json::from_str(ext.request.params.get()) {\n        Ok(r) => r,\n        Err(e) => {\n            tracing::error!(error = %e, \"Failed to parse McpElicitExtRequest\");\n            ext.response_tx\n                .send(Err(acp::Error::new(-32602, format!(\"Invalid params: {e}\"))))\n                .ok();\n            return false;\n        }\n    };\n\n    let Some(id) = interaction_target_agent(app, &ext_req.session_id) else {\n        tracing::info!(\n            session_id = %ext_req.session_id,\n            \"mcp elicit for a session with no local view; parked for leader replay-on-attach\"\n        );\n        drop(ext.response_tx);\n        return false;\n    };\n    let is_active = is_matched_agent_active(app, id);\n    let Some(agent) = app.agents.get_mut(&id) else {\n        drop(ext.response_tx);\n        return false;\n    };","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/app/acp_handler/interactions.rs#L7-L43","documentation":"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.","triggerScenarios":"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).","commonSituations":"Clients sending older/newer param shapes than the handler expects; JSON-encoded payloads double-quoted or truncated; schema drift after a version bump.","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"],"exampleFix":"// before\nlet params = json!({ \"sessionId\": id }); // wrong field name\nacp.extMethod(\"mcp_elicit\", params)?;\n// after\nlet params = json!({ \"session_id\": id });\nacp.extMethod(\"mcp_elicit\", params)?;","handlingStrategy":"validation","validationCode":"fn validate_elicit_params(raw: &str) -> Result<(), String> {\n    serde_json::from_str::<McpElicitExtRequest>(raw)\n        .map(|_| ())\n        .map_err(|e| format!(\"Invalid params: {e}\"))\n}","typeGuard":null,"tryCatchPattern":"match serde_json::from_str::<McpElicitExtRequest>(params) {\n    Err(e) => return Err(acp::Error::new(-32602, format!(\"Invalid params: {e}\"))),\n    Ok(req) => handle(req),\n}","preventionTips":["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"],"tags":["acp","json-rpc","invalid-params","serde"],"backgroundTag":"schema-validation-failed","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}