{"record":{"id":"c63617398b25dc81","repo":"Hmbown/CodeWhale","slug":"cannot-continue-agent-agent-id-no-runtime-is-av","errorCode":null,"errorMessage":"Cannot continue agent {agent_id}: no runtime is available to resume it","messagePattern":"Cannot continue agent (.+?): no runtime is available to resume it","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":5599,"sourceCode":"        let status = self\n            .agents\n            .get(&agent_id)\n            .map(|agent| agent.status.clone())\n            .ok_or_else(|| anyhow!(\"Agent {agent_id} not found\"))?;\n        match status {\n            SubAgentStatus::Running => {\n                let receipt = self.followup_child(&agent_id, text.to_string())?;\n                Ok(UserFollowUpOutcome {\n                    agent_id: agent_id.clone(),\n                    target_agent_id: agent_id,\n                    delivered: receipt.woke,\n                    resumed: false,\n                    note: receipt.note,\n                })\n            }\n            SubAgentStatus::Interrupted(_) | SubAgentStatus::Completed => {\n                let Some(runtime) = runtime else {\n                    return Err(anyhow!(\n                        \"Cannot continue agent {agent_id}: no runtime is available to resume it\"\n                    ));\n                };\n                let resumed = self.resume_from_checkpoint_with_policy(\n                    manager_handle,\n                    runtime,\n                    &agent_id,\n                    text,\n                    ResumePolicy::InterruptedOrCompleted,\n                )?;\n                let target = resumed.agent_id.clone();\n                Ok(UserFollowUpOutcome {\n                    agent_id,\n                    delivered: true,\n                    resumed: true,\n                    note: format!(\"continued from checkpoint as {target}\"),\n                    target_agent_id: target,\n                })","sourceCodeStart":5581,"sourceCodeEnd":5617,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tools/subagent/mod.rs#L5581-L5617","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","If no runtime is available in that context, route the action through the component that holds one instead of calling the manager directly","Fall back to spawning a fresh agent when runtime is None rather than attempting the continue"],"exampleFix":"// before\nlet outcome = manager\n    .continue_child_from_user(handle, None, &agent_ref, &text)?;\n\n// after\nlet outcome = manager\n    .continue_child_from_user(handle, session_runtime.as_ref(), &agent_ref, &text)?;","handlingStrategy":"validation","validationCode":"// Resume requires a runtime; check both preconditions before continuing.\nlet snap = manager.get_result_by_ref(&agent_ref)?;\nlet needs_runtime = matches!(snap.status,\n    SubAgentStatus::Interrupted(_) | SubAgentStatus::Completed);\nanyhow::ensure!(!needs_runtime || session_runtime.is_some(),\n    \"continue of a {status} agent requires the session runtime\", status = snap.status);","typeGuard":null,"tryCatchPattern":"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.","preventionTips":["Thread the runtime handle through every code path that can trigger continue actions","Audit call sites after any signature change that introduced Option<SubAgentRuntime>","In UI layers, disable continue actions for interrupted/completed agents when no runtime is wired"],"tags":["subagent","rust","resume","missing-runtime","invalid-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}