{"record":{"id":"0ba58662e5ff08a4","repo":"openai/codex","slug":"originating-mcp-tool-connector-does-not-match-its","errorCode":null,"errorMessage":"originating MCP tool connector does not match its app context","messagePattern":"originating MCP tool connector does not match its app context","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/codex-mcp/src/resource_origin.rs","lineNumber":265,"sourceCode":"\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\");\n        }\n        if self.link_id.is_none()\n            && tool_meta\n                .and_then(|meta| meta.get(\"_codex_apps\"))\n                .and_then(|meta| meta.get(\"requires_explicit_link_id\"))\n                .and_then(serde_json::Value::as_bool)\n                == Some(true)\n        {\n            anyhow::bail!(\"originating MCP tool requires an explicit account link\");\n        }","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/codex-mcp/src/resource_origin.rs#L247-L283","documentation":"Error \"originating MCP tool connector does not match its app context\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/codex-mcp/src/resource_origin.rs:265 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the connector that belongs to the app context of the originating tool call."],"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"}