openai/codex · error

originating MCP tool connector does not match its app contex

Error message

originating MCP tool connector does not match its app context

What it means

Error "originating MCP tool connector does not match its app context" thrown in openai/codex.

Source

Thrown at codex-rs/codex-mcp/src/resource_origin.rs:265

    pub(crate) async fn read(
        &self,
        binding: &McpBinding,
        thread_id: ThreadId,
        uri: &str,
    ) -> anyhow::Result<ReadResourceResult> {
        if self.uri != uri {
            anyhow::bail!("originating MCP tool call does not match the requested resource");
        }
        if self.ambiguous_account {
            anyhow::bail!("originating MCP tool call has ambiguous account selection");
        }

        let tool_info = binding
            .tool_info(CODEX_APPS_MCP_SERVER_NAME, &self.tool)
            .context("originating MCP tool is unavailable")?;
        if tool_info.connector_id.as_deref() != Some(self.connector_id.as_str()) {
            anyhow::bail!("originating MCP tool connector does not match its app context");
        }
        let tool_meta = tool_info.tool.meta.as_ref().map(|meta| &meta.0);
        let current_link_id = tool_meta
            .and_then(|meta| meta.get("link_id"))
            .and_then(serde_json::Value::as_str)
            .filter(|value| !value.trim().is_empty());
        if current_link_id != self.link_id.as_deref() {
            anyhow::bail!("originating MCP tool link does not match its app context");
        }
        if self.link_id.is_none()
            && tool_meta
                .and_then(|meta| meta.get("_codex_apps"))
                .and_then(|meta| meta.get("requires_explicit_link_id"))
                .and_then(serde_json::Value::as_bool)
                == Some(true)
        {
            anyhow::bail!("originating MCP tool requires an explicit account link");
        }

View on GitHub (pinned to 339751715c)

Solutions

  1. Use the connector that belongs to the app context of the originating tool call.

When it happens

Trigger: Thrown at codex-rs/codex-mcp/src/resource_origin.rs:265 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/0ba58662e5ff08a4. Report an issue: GitHub.