{"record":{"id":"8bbab9b20d4dfebb","repo":"openai/codex","slug":"mcp-tool-returned-an-error-text","errorCode":null,"errorMessage":"MCP tool returned an error: {text}","messagePattern":"MCP tool returned an error: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/core/src/hook_mcp_executor.rs","lineNumber":50,"sourceCode":"                    call.environment_id.as_deref(),\n                    Some(Value::Object(call.input)),\n                    Some(Value::Object(metadata)),\n                    Some(call.timeout),\n                    /*wait_for_server*/ false,\n                )\n                .await?;\n            let text = result\n                .content\n                .iter()\n                .filter_map(|content| {\n                    (content.get(\"type\").and_then(Value::as_str) == Some(\"text\"))\n                        .then(|| content.get(\"text\").and_then(Value::as_str))\n                        .flatten()\n                })\n                .collect::<Vec<_>>()\n                .join(\"\\n\");\n            if result.is_error == Some(true) {\n                bail!(\"MCP tool returned an error: {text}\");\n            }\n\n            Ok(text)\n        }\n        .boxed()\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":58,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/core/src/hook_mcp_executor.rs#L32-L58","documentation":"Error \"MCP tool returned an error: {text}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/core/src/hook_mcp_executor.rs:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the underlying MCP tool error reported in the message text."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}