coleam00/Archon · error

Cannot resume: Database lookup failed. Error: ${error.messag

Error message

Cannot resume: Database lookup failed.
Error: ${error.message}
Hint: Check your database connection before using --resume.

What it means

During a detached launch with --resume (a continuation), the CLI must look up the prior run row before forking. If the database lookup itself failed (resumeLookupError set), the pre-flight throws buildResumeLookupFailureError with the message 'Cannot resume: Database lookup failed.\nError: <detail>\nHint: Check your database connection before using --resume.' This refuses the launch synchronously rather than letting the child die after the parent printed 'Started' (#2872, #2747).

Source

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

      } else if (options.supersedesRunId !== undefined) {
        supersededRunId = await resolveRunIdArg(
          options.supersedesRunId,
          cwd,
          false,
          detachCodebase.id
        );
        await resolveSupersededRun(supersededRunId);
      }
    }

    // The run id the ack hands back. A continuation already has one; a fresh launch
    // gets a row written below, before the fork.
    let detachedRunId: string;
    // Only a row THIS process created may be failed when the child never takes it.
    // A continuation's row belongs to its own run.
    let launchedRunId: string | undefined;
    if (isContinuation) {
      if (resumeLookupError) throw buildResumeLookupFailureError(resumeLookupError);
      if (!continuationRun) throw buildNoResumableRunError(workflowName, cwd);
      detachedRunId = continuationRun.id;
    } else {
      // `Started` must mean a queryable run, so the row is written before the fork and
      // the child executes it rather than creating its own. Modeled on the
      // orchestrator's pre-created row (dispatchBackgroundWorkflowOwned), including
      // the stamps the executor only writes when IT creates the row. `working_path` is
      // the one field this process cannot know — the child cuts the worktree — so it
      // stays null until the child fills it in (write-once in the store).
      let detachedConversation;
      try {
        detachedConversation = await conversationDb.getOrCreateConversation(
          'cli',
          childConversationId
        );
      } catch (error) {
        const err = error as Error;
        throw new Error(

View on GitHub (pinned to 0773b97458)

Solutions

  1. Verify the database is running and reachable (e.g. psql with the same DSN)
  2. Check DATABASE_URL is set and correct in the environment or .env
  3. Re-run the command after connectivity is restored; nothing was forked so no run row was left behind
  4. If the run genuinely does not exist (rather than a lookup failure), drop --resume or pick the right workflow/cwd

Example fix

// before
DATABASE_URL= pnpm archon workflow run deploy --detach --resume
// after
export DATABASE_URL=postgres://user:pass@localhost:5432/archon
pg_isready -d "$DATABASE_URL" && pnpm archon workflow run deploy --detach --resume
Defensive patterns

Strategy: validation

Validate before calling

import { Client } from 'pg';
async function assertDbReachable(dsn) {
  const c = new Client({ connectionString: dsn });
  await c.connect(); await c.end();
}
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL not set');
await assertDbReachable(process.env.DATABASE_URL); // before `run --detach --resume`

Try / catch

try {
  await runWorkflow(name, { detach: true, resume: true });
} catch (e) {
  if (String(e.message).startsWith('Cannot resume: Database lookup failed.')) {
    // verify DB connectivity/DATABASE_URL, then retry once connectivity is restored
  } else throw e;
}

Prevention

When it happens

Trigger: Running `archon workflow run <name> --detach --resume` (isContinuation branch at workflow.ts:2079) where the database query for the continuation run raised — unreachable database, missing/misconfigured DATABASE_URL, network failure, or credentials rejected.

Common situations: Postgres not running or restarted; DATABASE_URL unset in the shell or .env not loaded; connecting from a machine/network that cannot reach the database; expired credentials.

Related errors


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