zed-industries/zed · warning
User canceled
Error message
User canceled
What it means
SubagentPromptResult::Cancelled maps to this error: the user interrupted the subagent's run (stop button or cancellation propagated from the parent), so no result content is produced. It is a control-flow outcome, not a defect.
Source
Thrown at crates/agent/src/agent.rs:3419
.last_message()
.and_then(|message| {
let content = message.as_agent_message()?
.content
.iter()
.filter_map(|c| match c {
AgentMessageContent::Text(text) => Some(text.as_str()),
_ => None,
})
.join("\n\n");
if content.is_empty() {
None
} else {
Some( content)
}
})
.context("No response from subagent")
}),
SubagentPromptResult::Cancelled => Err(anyhow!("User canceled")),
SubagentPromptResult::Error(message) => Err(anyhow!("{message}")),
SubagentPromptResult::ContextWindowWarning => {
thread.update(cx, |thread, cx| thread.cancel(cx)).await;
Err(anyhow!(
"The agent is nearing the end of its context window and has been \
stopped. You can prompt the thread again to have the agent wrap up \
or hand off its work."
))
}
};
parent_thread
.update(cx, |parent_thread, cx| {
parent_thread.unregister_running_subagent(&subagent_session_id, cx)
})
.ok();
resultView on GitHub (pinned to bc538def45)
Solutions
- Handle this error as 'cancelled' in the UI (show a stopped state) rather than as a failure.
- Do not retry automatically — the user chose to stop.
- Distinguish it from SubagentPromptResult::Error when presenting results.
Defensive patterns
Strategy: try-catch
Try / catch
match subagent_prompt_result {
Err(e) if e.to_string() == "User canceled" => {
// user abort: show stopped state, no retry
}
Err(e) => return Err(e),
Ok(output) => { /* use output */ }
} Prevention
- Classify this exact message as a cancellation in error presentation code.
- Never auto-retry after a user cancellation.
When it happens
Trigger: The user presses stop while a subagent is running; the parent thread is cancelled and cancellation reaches the subagent's prompt.
Common situations: Any user abort of a long-running subagent task; closing the parent run mid-subagent.
Related errors
- The agent is nearing the end of its context window and has b
- Parent thread no longer exists
- Maximum subagent depth ({}) reached
- No subagent session found with id {session_id}
- Resuming subagent sessions is not supported
AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16).
Data as JSON: /api/errors/e2e7e3c61ef9455a.
Report an issue: GitHub.