Hmbown/CodeWhale · error
Cannot continue agent
Error message
Cannot continue agent {agent_id}: no runtime is available to resume it What it means
Thrown by the continue-agent flow when the child's status is Interrupted or Completed (i.e. resumable) but no runtime handle was supplied to actually resume it. The registry can fork the continuation target from checkpoints but needs a live runtime (`manager_handle` + runtime) to drive the resumed child.
Solutions
- Pass a live runtime/manager handle into the continue call; only call continue once the engine is up.
- Defer the continuation until the runtime is initialized (queue the message and resume on startup).
- If the runtime shut down, treat the agent as unrecoverable and spawn a fresh child instead.
- In embedded/test usage, construct the registry through the same path that wires the runtime.
Example fix
// before
let outcome = registry.continue_agent(&handle, agent_ref, text, /* runtime */ None)?;
// after
let runtime = engine.runtime_handle().ok_or_else(|| anyhow!("engine not started"))?;
let outcome = registry.continue_agent(&handle, agent_ref, text, Some(runtime))?; Defensive patterns
Strategy: validation
Validate before calling
let runtime = engine.runtime_handle();
if runtime.is_none() {
anyhow::bail!("engine runtime not started; start the engine before continuing agents");
} Try / catch
match registry.continue_agent(&handle, agent_ref, text, runtime) {
Err(e) if e.to_string().contains("no runtime is available") => {
pending_continuations.push((agent_ref.to_string(), text)); // defer until runtime is up
}
r => r?,
} Prevention
- Only wire continue/follow-up UI actions after the engine runtime is initialized.
- Queue continuations requested during shutdown and replay them on startup.
- In embedded/test usage, construct the registry through the path that wires the runtime.
- Keep the runtime handle alive for as long as agent continuations can be requested.
When it happens
Trigger: Calling `continue_agent` (or the user continue path) for an Interrupted/Completed agent in a context where the `runtime` parameter is `None` — typically a headless/registry-only call path, or after the engine/runtime was shut down.
Common situations: Continuing an agent from a code path that constructed the registry without the runtime (e.g. tests, session restore before the engine starts); runtime dropped on shutdown while UI still holds a follow-up; embedding the tool handler without wiring the runtime.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Agent continuation target is no longer retained
- Agent continuation target is outside the active session
- Agent not found
- Agent session not found
- Agent session name ' ' is ambiguous; use an agent_id
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/c63617398b25dc81.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/subagent/mod.rs:6117
let status = self
.agents
.get(&agent_id)
.map(|agent| agent.status.clone())
.ok_or_else(|| anyhow!("Agent {agent_id} not found"))?;
match status {
SubAgentStatus::Running => {
let receipt = self.followup_child(&agent_id, text.to_string())?;
Ok(UserFollowUpOutcome {
agent_id: agent_id.clone(),
target_agent_id: agent_id,
delivered: receipt.woke,
resumed: false,
note: receipt.note,
})
}
SubAgentStatus::Interrupted(_) | SubAgentStatus::Completed => {
let Some(runtime) = runtime else {
return Err(anyhow!(
"Cannot continue agent {agent_id}: no runtime is available to resume it"
));
};
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,
})View on GitHub (pinned to 73e0f67d83)