zed-industries/zed · error · anyhow::Error

Session not found

Error message

Session not found

What it means

Sentinel error returned by NativeAgentConnection::run_turn when the given acp::SessionId has no entry in the agent's sessions map, i.e. the turn was requested for an unknown, closed, or already-removed thread session.

Solutions

  1. Verify the session id is current; re-list sessions or re-open the thread to obtain a valid id
  2. Recreate the thread/session if it was closed externally (panel reload, workspace change)
  3. Guard callers against reusing session ids captured before a restart
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/agent/src/agent.rs:2147 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/743f61c5802c77a6. Report an issue: GitHub.

Appendix: source

Thrown at crates/agent/src/agent.rs:2191

                thread.push_acp_user_block(client_user_message_id, combined, path_style, cx);
            });

            let response_stream = thread.update(cx, |thread, cx| thread.send_existing(cx))?;

            let connection = this.upgrade().map(NativeAgentConnection);
            cx.update(|cx| {
                NativeAgentConnection::handle_thread_events(
                    response_stream,
                    acp_thread.downgrade(),
                    connection,
                    cx,
                )
            })
            .await
        })
    }
}

/// Wrapper struct that implements the AgentConnection trait
#[derive(Clone)]
pub struct NativeAgentConnection(pub Entity<NativeAgent>);

impl NativeAgentConnection {
    pub fn thread(&self, session_id: &acp::SessionId, cx: &App) -> Option<Entity<Thread>> {
        self.0
            .read(cx)
            .sessions
            .get(session_id)
            .map(|session| session.thread.clone())
    }

    /// Forwards to [`NativeAgent::ensure_skills_scan_started`]. The
    /// agent panel calls this from its three user-interaction trigger
    /// points (input box focus, slash-autocomplete invocation, and
    /// conversation submit) so that the skills directory is observed
    /// only when the user is actually engaging with the panel.

View on GitHub (pinned to 916fc2b8cb)