Hmbown/CodeWhale · error
Cannot continue agent
Error message
Cannot continue agent {agent_id}: status is {} and the child cannot resume What it means
Thrown by the continue-agent flow's catch-all arm when the child's status is one that can never be resumed: Failed, Cancelled, BudgetExhausted, or any other non-resumable state. Only Running (live delivery), Interrupted, and Completed statuses continue; everything else fails closed.
Solutions
- Check the child's status first and only call continue for Interrupted/Completed/Running children.
- For Failed or Cancelled children, spawn a new child with the original task plus any partial output.
- For BudgetExhausted, increase the budget and spawn a fresh child (its budget is spent, not resumable).
- Inspect the status detail via `subagent_status_name` to understand which terminal state blocked the resume.
Example fix
// before
let outcome = registry.continue_agent(&handle, &agent_ref, text, runtime)?;
// after
match registry.status_of(&agent_ref) {
SubAgentStatus::Running | SubAgentStatus::Interrupted(_) | SubAgentStatus::Completed => {
registry.continue_agent(&handle, &agent_ref, text, runtime)?
}
other => {
let new_ref = registry.spawn_child_with_context(&original_task)?;
registry.user_follow_up(&new_ref, text)?
}
} Defensive patterns
Strategy: validation
Validate before calling
match registry.status_of(agent_ref) {
SubAgentStatus::Running | SubAgentStatus::Interrupted(_) | SubAgentStatus::Completed => {},
other => anyhow::bail!("agent is {:?}; cannot be continued, spawn a new child", other),
} Type guard
fn is_continueable(status: &SubAgentStatus) -> bool {
matches!(status, SubAgentStatus::Running | SubAgentStatus::Interrupted(_) | SubAgentStatus::Completed)
} Try / catch
match registry.continue_agent(&handle, agent_ref, text, runtime) {
Err(e) if e.to_string().contains("cannot resume") => {
let new_ref = registry.spawn_child_with_context(&original_task)?;
registry.user_follow_up(&new_ref, text)?
}
r => r?,
} Prevention
- Gate 'continue' UI actions on the child's live status, not on stale snapshots.
- Failed/Cancelled/BudgetExhausted children are never resumable — always spawn fresh.
- BudgetExhausted requires a bigger budget on a new child, not a resume.
- Re-read status right before continuing to narrow check/act races.
When it happens
Trigger: Calling `continue_agent` on a child that failed, was cancelled, exhausted its budget, or is otherwise in a terminal non-resumable status (the `other =>` match arm).
Common situations: User hits 'continue' in the UI on a failed child; a retry script blindly continues agents regardless of status; a budget-exhausted child is continued without raising the budget; status changed to Failed between the check and the continue call.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Cannot follow up agent
- Cannot resume agent : status is ( )
- Agent continuation target is no longer retained
- Agent continuation target is outside the active session
- Agent not found
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/4208e5f4943ab919.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/subagent/mod.rs:6137
));
};
let resumed = self.resume_from_checkpoint_with_policy(
manager_handle,
runtime,
&agent_id,
text,
ResumePolicy::InterruptedOrCompleted,
)?;
let target = resumed.agent_id.clone();
Ok(UserFollowUpOutcome {
agent_id,
delivered: true,
resumed: true,
note: format!("continued from checkpoint as {target}"),
target_agent_id: target,
})
}
other => Err(anyhow!(
"Cannot continue agent {agent_id}: status is {} and the child cannot resume",
subagent_status_name(&other)
)),
}
}
pub(crate) fn continue_child_from_user_for_session(
&mut self,
active_session_id: &str,
manager_handle: SharedSubAgentManager,
runtime: Option<SubAgentRuntime>,
agent_ref: &str,
text: &str,
) -> Result<UserFollowUpOutcome> {
let agent_id = self.resolve_agent_ref_for_session(active_session_id, agent_ref)?;
self.continue_child_from_user(manager_handle, runtime, &agent_id, text)
}
View on GitHub (pinned to 73e0f67d83)