{"record":{"id":"5c683015e49bb173","repo":"openai/codex","slug":"originating-mcp-tool-call-does-not-match-the-reque","errorCode":null,"errorMessage":"originating MCP tool call does not match the requested resource","messagePattern":"originating MCP tool call does not match the requested resource","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/codex-mcp/src/resource_origin.rs","lineNumber":255,"sourceCode":"\nimpl ResourceOrigin {\n    fn byte_len(&self) -> usize {\n        self.call_id.len()\n            + self.turn_id.as_ref().map_or(0, String::len)\n            + self.tool.len()\n            + self.connector_id.len()\n            + self.link_id.as_ref().map_or(0, String::len)\n            + self.uri.len()\n    }\n\n    pub(crate) async fn read(\n        &self,\n        binding: &McpBinding,\n        thread_id: ThreadId,\n        uri: &str,\n    ) -> anyhow::Result<ReadResourceResult> {\n        if self.uri != uri {\n            anyhow::bail!(\"originating MCP tool call does not match the requested resource\");\n        }\n        if self.ambiguous_account {\n            anyhow::bail!(\"originating MCP tool call has ambiguous account selection\");\n        }\n\n        let tool_info = binding\n            .tool_info(CODEX_APPS_MCP_SERVER_NAME, &self.tool)\n            .context(\"originating MCP tool is unavailable\")?;\n        if tool_info.connector_id.as_deref() != Some(self.connector_id.as_str()) {\n            anyhow::bail!(\"originating MCP tool connector does not match its app context\");\n        }\n        let tool_meta = tool_info.tool.meta.as_ref().map(|meta| &meta.0);\n        let current_link_id = tool_meta\n            .and_then(|meta| meta.get(\"link_id\"))\n            .and_then(serde_json::Value::as_str)\n            .filter(|value| !value.trim().is_empty());\n        if current_link_id != self.link_id.as_deref() {\n            anyhow::bail!(\"originating MCP tool link does not match its app context\");","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/codex-mcp/src/resource_origin.rs#L237-L273","documentation":"Guard in ResourceOrigin::read: the resource URI being read differs from the URI captured from the originating MCP tool call, so the read request does not correspond to the tool output it claims to originate from.","triggerScenarios":"Thrown at codex-rs/codex-mcp/src/resource_origin.rs:255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Access the resource through the same MCP tool call that originated it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}