{"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":6117,"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":6099,"sourceCodeEnd":6135,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/mod.rs#L6099-L6135","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlet outcome = registry.continue_agent(&handle, agent_ref, text, /* runtime */ None)?;\n// after\nlet runtime = engine.runtime_handle().ok_or_else(|| anyhow!(\"engine not started\"))?;\nlet outcome = registry.continue_agent(&handle, agent_ref, text, Some(runtime))?;","handlingStrategy":"validation","validationCode":"let runtime = engine.runtime_handle();\nif runtime.is_none() {\n    anyhow::bail!(\"engine runtime not started; start the engine before continuing agents\");\n}","typeGuard":null,"tryCatchPattern":"match registry.continue_agent(&handle, agent_ref, text, runtime) {\n    Err(e) if e.to_string().contains(\"no runtime is available\") => {\n        pending_continuations.push((agent_ref.to_string(), text)); // defer until runtime is up\n    }\n    r => r?,\n}","preventionTips":["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."],"tags":["subagent","missing-dependency","runtime","rust"],"backgroundTag":"missing-dependency","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}