zed-industries/zed · error

Could not find session: {:?}

Error message

Could not find session: {:?}

What it means

shutdown_session was asked to stop a session id that is not present in the sessions map — it was already shut down, never existed, or was removed by a concurrent shutdown. The guard prevents double-shutdown work; callers treating it as fatal usually raced with another shutdown path.

Source

Thrown at crates/project/src/debugger/dap_store.rs:743

    pub fn shutdown_sessions(&mut self, cx: &mut Context<Self>) -> Task<()> {
        let mut tasks = vec![];
        for session_id in self.sessions.keys().cloned().collect::<Vec<_>>() {
            tasks.push(self.shutdown_session(session_id, cx));
        }

        cx.background_executor().spawn(async move {
            futures::future::join_all(tasks).await;
        })
    }

    pub fn shutdown_session(
        &mut self,
        session_id: SessionId,
        cx: &mut Context<Self>,
    ) -> Task<Result<()>> {
        let Some(session) = self.sessions.remove(&session_id) else {
            return Task::ready(Err(anyhow!("Could not find session: {:?}", session_id)));
        };

        let shutdown_children = session
            .read(cx)
            .child_session_ids()
            .iter()
            .map(|session_id| self.shutdown_session(*session_id, cx))
            .collect::<Vec<_>>();

        let shutdown_parent_task = if let Some(parent_session) = session
            .read(cx)
            .parent_id(cx)
            .and_then(|session_id| self.session_by_id(session_id))
        {
            let shutdown_id = parent_session.update(cx, |parent_session, _| {
                parent_session.remove_child_session_id(session_id);

                if parent_session.child_session_ids().is_empty() {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Treat as benign if concurrent shutdowns are possible (e.g. app close plus explicit stop)
  2. Check for stale session ids held by UI state after a session ended
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/project/src/debugger/dap_store.rs:743 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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