openai/codex · error · anyhow::Error

failed to send elicitation response: {e:?}

Error message

failed to send elicitation response: {e:?}

What it means

Error "failed to send elicitation response: {e:?}" thrown in openai/codex.

Source

Thrown at codex-rs/core/src/session/mcp.rs:631

        &self,
        server_name: String,
        id: RequestId,
        response: ElicitationResponse,
    ) -> anyhow::Result<()> {
        let entry = {
            let mut active = self.active_turn.lock().await;
            match active.as_mut() {
                Some(at) => {
                    let mut ts = at.turn_state.lock().await;
                    ts.remove_pending_elicitation(&server_name, &id)
                }
                None => None,
            }
        };
        if let Some(tx_response) = entry {
            tx_response
                .send(response)
                .map_err(|e| anyhow::anyhow!("failed to send elicitation response: {e:?}"))?;
            return Ok(());
        }

        self.services
            .mcp_runtime
            .resolve_elicitation(server_name, id, response)
            .await
    }

    pub(crate) async fn refresh_mcp_servers_now(
        &self,
        turn_context: &TurnContext,
        refresh_config: &Config,
        elicitation_reviewer: Option<ElicitationReviewerHandle>,
    ) {
        let Ok(_refresh) = self.mcp_refresh.acquire().await else {
            error!("MCP runtime refresh semaphore closed");
            return;

View on GitHub (pinned to 339751715c)

Solutions

  1. Retry sending the elicitation response and verify the MCP connection is alive.

When it happens

Trigger: Thrown at codex-rs/core/src/session/mcp.rs:631 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/4ea4a34987997470. Report an issue: GitHub.