zed-industries/zed · error
No subagent session found with id {session_id}
Error message
No subagent session found with id {session_id} What it means
resume_subagent_thread looks the id up in agent.sessions and fails when it is absent: the subagent session was either never created in this process or has already been closed.
Source
Thrown at crates/agent/src/agent.rs:3101
session = parent_thread_entity.read(cx).id().to_string(),
subagent_session = session_id.to_string(),
depth,
is_resumed = false,
);
self.prompt_subagent(session_id, subagent_thread, acp_thread)
}
pub(crate) fn resume_subagent_thread(
&self,
session_id: acp::SessionId,
cx: &mut App,
) -> Result<Rc<dyn SubagentHandle>> {
let (subagent_thread, acp_thread) = self.agent.update(cx, |agent, _cx| {
let session = agent
.sessions
.get(&session_id)
.ok_or_else(|| anyhow!("No subagent session found with id {session_id}"))?;
anyhow::Ok((session.thread.clone(), session.acp_thread.clone()))
})??;
let depth = subagent_thread.read(cx).depth();
if let Some(parent_thread_entity) = self.thread.upgrade() {
telemetry::event!(
"Subagent Started",
session = parent_thread_entity.read(cx).id().to_string(),
subagent_session = session_id.to_string(),
depth,
is_resumed = true,
);
}
self.prompt_subagent(session_id, subagent_thread, acp_thread)
}
View on GitHub (pinned to bc538def45)
Solutions
- Use create_subagent_thread to start a fresh subagent instead of resuming when the id is not from the current process.
- Verify the id exists in the session list before attempting resume.
- Persist enough context to recreate the subagent rather than relying on in-memory session continuity.
Defensive patterns
Strategy: validation
Validate before calling
// only resume ids that still exist in this process
let resumable = session_ids_from_current_process.contains(&session_id);
if !resumable {
// create a new subagent and re-feed context instead
} Try / catch
match env.resume_subagent_thread(session_id.clone(), cx) {
Ok(handle) => handle,
Err(e) if e.to_string().contains("No subagent session found") => {
env.create_subagent_thread(label, cx)? // fall back to fresh subagent
}
Err(e) => return Err(e),
} Prevention
- Do not persist subagent session ids across restarts and assume they resume.
- Track subagent ids from the same agent instance you resume them against.
When it happens
Trigger: Calling resume_subagent with an id from a previous app run, from a different agent instance, or after the subagent finished and its session entry was removed.
Common situations: Persisted plans referencing subagent session ids after a restart; cross-workspace resume attempts; resuming already-completed subagents.
Related errors
- message not found
- no thread found with ID: {id:?}
- Project state not found for session
- Session not found
- Parent thread no longer exists
AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16).
Data as JSON: /api/errors/b79c46d4316565f6.
Report an issue: GitHub.