{"record":{"id":"1733d83c66204a47","repo":"tinyhumansai/openhuman","slug":"workflow-run-run-id-vanished-mid-phase","errorCode":null,"errorMessage":"workflow run {run_id} vanished mid-phase","messagePattern":"workflow run (.+?) vanished mid-phase","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/orchestration/workflow_runs/engine.rs","lineNumber":515,"sourceCode":"/// cancellation landed mid-phase (the terminal status is persisted first).\n#[allow(clippy::too_many_arguments)]\npub(super) async fn execute_phase(\n    config: &Config,\n    run_id: &str,\n    definition: &WorkflowDefinition,\n    session: &crate::openhuman::agent::orchestration::AgentOrchestrationSession,\n    cancel: &Arc<AtomicBool>,\n    model_override: Option<String>,\n    phase: &WorkflowPhase,\n    total_spawned: u32,\n) -> Result<PhaseExecOutcome> {\n    use crate::openhuman::agent::orchestration::{\n        AgentStatus, SpawnAgentRequest, WaitAgentOptions,\n    };\n\n    // Reload so the phase state we mutate + persist is the latest projection.\n    let run = get_workflow_run(&config.workspace_dir, run_id)?\n        .ok_or_else(|| anyhow!(\"workflow run {run_id} vanished mid-phase\"))?;\n    let mut phase_states = run.phase_states.clone();\n    let mut child_run_ids = run.child_run_ids.clone();\n    // Children launched *this* phase (the reducer delta added to `total_spawned`).\n    let mut spawned_this_phase: u32 = 0;\n\n    log::debug!(\n        target: LOG_TARGET,\n        \"[workflow_run_engine] phase.start run={run_id} phase={} agents={} spawned_so_far={}\",\n        phase.name,\n        phase.agent_ids.len(),\n        total_spawned\n    );\n    set_phase_status(&mut phase_states, &phase.name, PHASE_RUNNING, None);\n    persist(\n        config,\n        &run,\n        phase_states.clone(),\n        child_run_ids.clone(),","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/orchestration/workflow_runs/engine.rs#L497-L533","documentation":"execute_phase re-read the run row to refresh phase state and found it missing mid-phase — the run vanished while a phase was executing. Same external-interference class as the mid-loop vanishing guard: concurrent deletion or ledger fault; the phase aborts rather than persisting progress to a nonexistent run.","triggerScenarios":"Thrown at src/openhuman/agent/orchestration/workflow_runs/engine.rs:515 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Identify what removed the run row (concurrent stop/delete, ledger reset) and prevent concurrent mutation during execution","Check ledger read logs for SQLite failures","Recreate/restart the run if the deletion was unintended"],"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"}