{"record":{"id":"a6ae63f6d8bfa2b2","repo":"tinyhumansai/openhuman","slug":"unknown-workflow-run-id","errorCode":null,"errorMessage":"unknown workflow run: {id}","messagePattern":"unknown workflow run: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/orchestration/workflow_runs/engine.rs","lineNumber":293,"sourceCode":"    )\n    .context(\"persist workflow run interrupt\")?;\n\n    log::debug!(target: LOG_TARGET, \"[workflow_run_engine] stop.marked_interrupted run={id}\");\n    Ok(Some(updated))\n}\n\n/// Resume an interrupted (or otherwise incomplete) workflow run.\n///\n/// Reloads the run, clears any stale cancellation flag, flips the row back to\n/// `Running`, and spawns a fresh engine loop. Phases already `completed` in\n/// `phase_states` are skipped; the loop continues from the first incomplete\n/// phase whose dependencies are satisfied. Returns the run row (now `Running`),\n/// or an error if the run is unknown / already terminal-complete / its\n/// definition no longer exists.\npub async fn resume_workflow_run(config: &Config, id: &str) -> Result<WorkflowRun> {\n    log::debug!(target: LOG_TARGET, \"[workflow_run_engine] resume.entry run={id}\");\n    let run = get_workflow_run(&config.workspace_dir, id)?\n        .ok_or_else(|| anyhow!(\"unknown workflow run: {id}\"))?;\n\n    if matches!(run.status, WorkflowRunStatus::Completed) {\n        return Err(anyhow!(\"workflow run {id} is already completed\"));\n    }\n\n    let definition = definition_by_id(&run.definition_id)\n        .ok_or_else(|| anyhow!(\"definition {} no longer exists\", run.definition_id))?;\n\n    // Clear any prior cancellation intent and re-register a fresh flag.\n    clear_cancel_flag(id);\n    register_cancel_flag(id);\n\n    let resumed = upsert_workflow_run(\n        &config.workspace_dir,\n        WorkflowRunUpsert {\n            id: run.id.clone(),\n            definition_id: run.definition_id.clone(),\n            parent_thread_id: run.parent_thread_id.clone(),","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/src/openhuman/agent/orchestration/workflow_runs/engine.rs#L275-L311","documentation":"Thrown by workflow_runs::engine::resume_workflow_run when get_workflow_run finds no persisted run with that id in the workspace run ledger. The lookup is the first step of resume, before status checks, so nothing is mutated when it fires.","triggerScenarios":"Calling workflow run resume with a run id that was never created, was created under a different workspace_dir, or whose ledger row was deleted. Also fires for ids mangled in transit (truncated UUIDs, wrong prefix).","commonSituations":"Resuming after a workspace reset; the run id copied from another environment/core instance; resuming a run whose create call actually failed.","solutions":["List/get workflow runs in this workspace and confirm the id exists","Verify you are talking to the same core/workspace that started the run","If the run is genuinely gone, start a new run instead of resuming"],"exampleFix":"// before\nresume_workflow_run(&config, run_id).await?;\n\n// after — guard on existence and fall back to a fresh start\nlet run = match get_workflow_run(&config.workspace_dir, run_id)? {\n    Some(r) => resume_workflow_run(&config, &r.id).await?,\n    None => start_workflow_run(&config, definition_id, input, None).await?,\n};","handlingStrategy":"validation","validationCode":"let run = get_workflow_run(&config.workspace_dir, run_id)?;\nanyhow::ensure!(run.is_some(), \"unknown workflow run {run_id} — list runs in this workspace first\");","typeGuard":"fn run_exists(config: &Config, run_id: &str) -> bool {\n    get_workflow_run(&config.workspace_dir, run_id).map_or(false, |r| r.is_some())\n}","tryCatchPattern":"match resume_workflow_run(&config, run_id).await {\n    Ok(r) => Ok(r),\n    Err(e) if e.to_string().starts_with(\"unknown workflow run\") => {\n        // run gone (workspace reset?) — restart from a current definition instead\n        start_workflow_run(&config, definition_id, input, None).await\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Persist run ids from the start_workflow_run response and pass them unmodified","Confirm the workspace/core instance matches the one that created the run before resuming","Handle 'unknown run' by starting fresh, not by retrying the same id"],"tags":["workflow-runs","validation","run-id"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}