zed-industries/zed · error

failed to wait for agent server exit

Error message

failed to wait for agent server exit: {err}

What it means

Logged when the ACP connection supervisor fails to await the child agent-server process's status future while monitoring whether the spawned server exited. This is an infrastructure error in the connection lifecycle: the underlying error {err} comes from the async child process machinery (e.g. the I/O loop was dropped), not from the agent protocol itself.

Solutions

  1. Check system process limits and ensure spawning child processes is permitted
  2. Restart the agent server connection so a fresh child process is spawned
  3. Inspect the agent server's debug log for why its process lifecycle ended abnormally
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/agent_servers/src/acp.rs:963 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20). Data as JSON: /api/errors/128a57908ddcd605. Report an issue: GitHub.

Appendix: source

Thrown at crates/agent_servers/src/acp.rs:951

        let io_task = cx.background_spawn(async move {
            if let Err(err) = connection_future.await {
                log::error!("ACP connection error: {err}");
            }
        });

        let connection_rx = async move {
            connection_rx
                .await
                .context("Failed to receive ACP connection handle")
        }
        .boxed_local();
        let status_fut = child
            .status()
            .map({
                let debug_log = debug_log.clone();
                move |status| match status {
                    Ok(status) => Ok(exited_load_error_with_stderr(status, &debug_log)),
                    Err(err) => Err(anyhow!("failed to wait for agent server exit: {err}")),
                }
            })
            .boxed_local();
        let (connection, status_fut) = match futures::future::select(connection_rx, status_fut)
            .await
        {
            futures::future::Either::Left((connection, status_fut)) => (connection?, status_fut),
            futures::future::Either::Right((load_error, _connection_rx)) => {
                return Err(load_error?.into());
            }
        };

        // Set up the foreground dispatch loop to process work items from handlers.
        let dispatch_context = ClientContext {
            sessions: sessions.clone(),
            session_list: client_session_list.clone(),
            request_elicitations: request_elicitations.clone(),
        };

View on GitHub (pinned to 916fc2b8cb)