Hmbown/CodeWhale · error
Cannot continue agent {agent_id}: status is {} and the child
Error message
Cannot continue agent {agent_id}: status is {} and the child cannot resume What it means
continue_child_from_user only handles three statuses: Running (delivered as live mail), and Interrupted(_)/Completed (checkpoint resume). Any other status hits the catch-all arm and is refused because the child cannot resume: a Failed, Cancelled, or BudgetExhausted agent has no continuation path in this API. The message includes the concrete status name via subagent_status_name.
Source
Thrown at crates/tui/src/tools/subagent/mod.rs:5619
));
};
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 0c42157ee5)
Solutions
- Spawn a replacement agent whose prompt embeds the failed agent's last known output; there is no resume path for Failed/Cancelled/BudgetExhausted
- Check status with get_result_by_ref first and only issue continue for Running, Interrupted, or Completed agents
- For BudgetExhausted agents, respawn with a fresh token budget configured on the spawn
Example fix
// before
let outcome = manager.continue_child_from_user(handle, runtime, &agent_ref, &text)?;
// after
let snap = manager.get_result_by_ref(&agent_ref)?;
if matches!(snap.status,
SubAgentStatus::Running
| SubAgentStatus::Interrupted(_)
| SubAgentStatus::Completed) {
manager.continue_child_from_user(handle, runtime, &agent_ref, &text)?;
} else {
spawn_replacement(manager, &agent_ref, &text).await?;
} Defensive patterns
Strategy: type-guard
Validate before calling
let snap = manager.get_result_by_ref(&agent_ref)?;
anyhow::ensure!(continuable_status(&snap.status),
"agent {agent_ref} status {} cannot continue", snap.status); Type guard
fn continuable_status(status: &SubAgentStatus) -> bool {
matches!(status,
SubAgentStatus::Running
| SubAgentStatus::Interrupted(_)
| SubAgentStatus::Completed)
} Try / catch
On 'Cannot continue agent ... cannot resume', read the status word and route: Failed/Cancelled -> respawn with a summary; BudgetExhausted -> respawn with a fresh budget. Suppress retry loops.
Prevention
- Model agent state explicitly in orchestration code (Runnable / Resumable / Dead) instead of calling continue unconditionally
- Consume completion/failure events to retire agents from the continuable set
- For user-facing commands, map the refusal to a clear 'agent ended; start a new one' message
When it happens
Trigger: Calling continue on an agent whose status is Failed(_), Cancelled, or BudgetExhausted; a status race where the agent fails or gets cancelled between the caller's check and the continue call; continuing an agent cancelled to free admission capacity.
Common situations: User retries a 'continue' action on an agent that crashed earlier; orchestration code treats continue as a universal retry; agents cancelled by admission pressure or heartbeat timeouts receiving continue commands.
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 {agent_id}: status is {} and the chil
- fleet run {} is already terminal ({lifecycle:?})
- Cannot resume agent {agent_id}: status is {} ({})
- terminal lane transition requires a terminal status
- lane `{}` was stopped before tmux launch
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/4208e5f4943ab919.
Report an issue: GitHub.