Hmbown/CodeWhale · error

Cannot continue agent {agent_id}: no runtime is available to

Error message

Cannot continue agent {agent_id}: no runtime is available to resume it

What it means

Resuming an Interrupted or Completed child requires a SubAgentRuntime to relaunch the child loop; continue_child_from_user received None for its runtime parameter and therefore cannot replay the checkpoint. The runtime carries the provider/model execution surface, and without it the checkpoint is inert data. Only the Running branch (plain mail followup) works without a runtime.

Source

Thrown at crates/tui/src/tools/subagent/mod.rs:5599

        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 0c42157ee5)

Solutions

  1. Propagate the runtime: the caller that owns the child's execution surface (the session/owner that spawned it) must pass Some(runtime) into continue_child_from_user
  2. If no runtime is available in that context, route the action through the component that holds one instead of calling the manager directly
  3. Fall back to spawning a fresh agent when runtime is None rather than attempting the continue

Example fix

// before
let outcome = manager
    .continue_child_from_user(handle, None, &agent_ref, &text)?;

// after
let outcome = manager
    .continue_child_from_user(handle, session_runtime.as_ref(), &agent_ref, &text)?;
Defensive patterns

Strategy: validation

Validate before calling

// Resume requires a runtime; check both preconditions before continuing.
let snap = manager.get_result_by_ref(&agent_ref)?;
let needs_runtime = matches!(snap.status,
    SubAgentStatus::Interrupted(_) | SubAgentStatus::Completed);
anyhow::ensure!(!needs_runtime || session_runtime.is_some(),
    "continue of a {status} agent requires the session runtime", status = snap.status);

Try / catch

Match on 'no runtime is available to resume it' and fall back to spawning a fresh agent carrying the checkpoint summary; the error is deterministic, so retrying unchanged never helps.

Prevention

When it happens

Trigger: Calling continue_child_from_user with runtime: None while the target's status is Interrupted(_) or Completed; a UI or API entry point that did not propagate the session's runtime handle into the continue action; embedding code that constructs the call with a hardcoded None.

Common situations: A refactor made the runtime an explicit parameter and a call site was not updated; continue invoked from a context (e.g., a pure event handler) that never had access to the runtime; tests calling the method with None to simplify setup.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/c63617398b25dc81. Report an issue: GitHub.