coleam00/Archon · error · Error

Cannot resume workflow '${workflowName}': failed to load pri

Error message

Cannot resume workflow '${workflowName}': failed to load prior run state — ${err.message}

What it means

When resuming, the CLI hydrates prior run state so execution can continue from completed nodes; if loading that state throws, the error is re-thrown with the workflow name and original message, telling the user the prior run's state could not be loaded (logged as 'cli.workflow_hydrate_resume_failed').

Source

Thrown at packages/cli/src/commands/workflow.ts:2968

    );
  }

  // When --resume, hand the already-found run (and its completed-node outputs)
  // to executeWorkflow. Otherwise this is a fresh run and prepared stays null.
  // The lookup-by-(workflowName, cwd) was already done above for worktree-path
  // resolution; reuse that result rather than querying twice.
  const deps = createWorkflowDeps();
  let prepared: Awaited<ReturnType<typeof hydrateResumableRun>> = null;
  if (options.resume && resumable) {
    try {
      prepared = await hydrateResumableRun(deps, resumable);
    } catch (error) {
      const err = error as Error;
      getLog().error(
        { err, workflowName, runId: resumable.id },
        'cli.workflow_hydrate_resume_failed'
      );
      throw new Error(
        `Cannot resume workflow '${workflowName}': failed to load prior run state — ${err.message}`
      );
    }
    if (!prepared) {
      throw new Error(
        `Cannot resume: the prior run for '${workflowName}' has no completed nodes and no interactive-loop state.`
      );
    }
  }

  // Execute workflow with workingCwd (may be worktree path). `undefined` until
  // assigned so the finally-block teardown can tell "threw before a result" from
  // a real terminal/paused result.
  let result: Awaited<ReturnType<typeof executeWorkflow>> | undefined;
  // A genuine container-teardown failure captured in the finally, rethrown AFTER
  // the finally when the run itself succeeded — so a leaked privileged container
  // fails the CLI instead of reporting success + exit 0.
  let containerTeardownError: Error | undefined;

View on GitHub (pinned to 0773b97458)

Solutions

  1. Re-run the resume; transient DB read failures may clear.
  2. Check logs for 'cli.workflow_hydrate_resume_failed' — the underlying error is included in the thrown message.
  3. If state is corrupted or schema-incompatible, start a fresh run instead of resuming.
  4. Align binary and database schema versions (update archon or follow database docs).
Defensive patterns

Strategy: try-catch

Validate before calling

// check the run has hydratable state before attempting resume
const prior = await store.getWorkflowRun(resumable.id);
if (!prior || (!prior.completedNodes?.length && !prior.interactiveLoopState)) {
  throw new Error('Run has no resumable state; start a fresh run instead');
}

Type guard

function isResumableState(s: unknown): s is { completedNodes: unknown[]; interactiveLoopState?: unknown } {
  return typeof s === 'object' && s !== null && Array.isArray((s as { completedNodes?: unknown }).completedNodes);
}

Try / catch

try {
  prepared = await hydrateResume(resumable.id);
} catch (error) {
  const err = error as Error;
  getLog().error({ err, runId: resumable.id }, 'cli.workflow_hydrate_resume_failed');
  throw new Error(`Cannot resume workflow '${workflowName}': failed to load prior run state — ${err.message}`);
}

Prevention

When it happens

Trigger: `archon workflow <name> --resume` where hydrating the resumable run throws — corrupted or truncated run-state JSON, DB read failure, or schema drift between the version that wrote the state and the current binary.

Common situations: Database restored or moved leaving inconsistent run rows; upgrading archon across a schema change; disk-full during the original run left partial state; manual DB edits.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/908f281ae0724632. Report an issue: GitHub.