{"record":{"id":"f653258421fbb21d","repo":"tinyhumansai/openhuman","slug":"workflow-run-run-id-vanished-mid-loop","errorCode":null,"errorMessage":"workflow run {run_id} vanished mid-loop","messagePattern":"workflow run (.+?) vanished mid-loop","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/orchestration/workflow_runs/engine.rs","lineNumber":428,"sourceCode":"    Continue { spawned: u32 },\n    /// The run reached a terminal status (already persisted) — route to `done`.\n    Terminated,\n}\n\n/// `dispatch` step: reload the run, honour cancellation, and pick the next\n/// runnable phase (pending, all deps `completed`). When none remains, persist the\n/// terminal status (Completed / Failed) and return [`PhaseSelection::Terminated`].\npub(super) async fn select_next_phase(\n    config: &Config,\n    run_id: &str,\n    definition: &WorkflowDefinition,\n    cancel: &Arc<AtomicBool>,\n    session: &crate::openhuman::agent::orchestration::AgentOrchestrationSession,\n) -> Result<PhaseSelection> {\n    // Reload so we read the latest phase_states (and a resume picks up persisted\n    // progress).\n    let run = get_workflow_run(&config.workspace_dir, run_id)?\n        .ok_or_else(|| anyhow!(\"workflow run {run_id} vanished mid-loop\"))?;\n    let phase_states = run.phase_states.clone();\n    let child_run_ids = run.child_run_ids.clone();\n\n    // Cancellation check between phases.\n    if cancel.load(Ordering::SeqCst) {\n        log::debug!(\n            target: LOG_TARGET,\n            \"[workflow_run_engine] loop.cancelled run={run_id}\"\n        );\n        session.abort_all().await;\n        persist(\n            config,\n            &run,\n            phase_states,\n            child_run_ids,\n            WorkflowRunStatus::Interrupted,\n            None,\n            false,","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/orchestration/workflow_runs/engine.rs#L410-L446","documentation":"The engine loop's dispatch step re-read the run row mid-loop and it no longer exists in the ledger. The run was executing moments ago, so this indicates external interference — concurrent deletion, workspace switched, or a ledger fault — not a normal lifecycle transition. The guard prevents the loop from operating on a phantom run.","triggerScenarios":"Thrown at src/openhuman/agent/orchestration/workflow_runs/engine.rs:428 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check whether the run was concurrently stopped/deleted from another session or the UI","Verify the ledger store's health (SQLite errors on read)","Restart the run from its definition if it was deleted unintentionally"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}