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

No subagent session found with id

Error message

No subagent session found with id {session_id}

What it means

Raised in resume_subagent_thread when the agent's session map has no entry for the given acp::SessionId. The subagent session being resumed no longer exists (expired or never created), so there is no thread to hand back to the caller.

Solutions

  1. Verify the subagent session id is valid and belongs to this agent instance
  2. Resume the parent thread instead if the subagent session no longer exists
  3. Re-create the subagent rather than resuming when its session was dropped (e.g. after restart)
Defensive patterns

Strategy: type-guard

When it happens

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

Appendix: source

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

struct NativeAgentSessionRetry {
    connection: NativeAgentConnection,
    session_id: acp::SessionId,
}

impl acp_thread::AgentSessionRetry for NativeAgentSessionRetry {
    fn run(&self, cx: &mut App) -> Task<Result<acp::PromptResponse>> {
        self.connection
            .run_turn(self.session_id.clone(), cx, |thread, cx| {
                thread.update(cx, |thread, cx| thread.resume(cx))
            })
    }
}

struct NativeAgentSessionSetTitle {
    thread: Entity<Thread>,
}

impl acp_thread::AgentSessionSetTitle for NativeAgentSessionSetTitle {
    fn run(&self, title: SharedString, cx: &mut App) -> Task<Result<()>> {
        self.thread
            .update(cx, |thread, cx| thread.set_title(title, cx));
        Task::ready(Ok(()))
    }
}

pub struct NativeThreadEnvironment {
    agent: WeakEntity<NativeAgent>,
    thread: WeakEntity<Thread>,
    acp_thread: WeakEntity<AcpThread>,
}

impl NativeThreadEnvironment {
    pub(crate) fn create_subagent_thread(
        &self,
        label: String,

View on GitHub (pinned to 916fc2b8cb)