openai/codex · error

originating MCP tool call has ambiguous account selection

Error message

originating MCP tool call has ambiguous account selection

What it means

Error "originating MCP tool call has ambiguous account selection" thrown in openai/codex.

Source

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

        self.call_id.len()
            + self.turn_id.as_ref().map_or(0, String::len)
            + self.tool.len()
            + self.connector_id.len()
            + self.link_id.as_ref().map_or(0, String::len)
            + self.uri.len()
    }

    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

View on GitHub (pinned to 339751715c)

Solutions

  1. Specify an explicit account link for the tool call so the account selection is unambiguous.

When it happens

Trigger: Thrown at codex-rs/codex-mcp/src/resource_origin.rs:258 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/971fa0c5e566db76. Report an issue: GitHub.