coleam00/Archon · error · Error
Failed to load codebase '${codebaseId}' for workflow run '${
Error message
Failed to load codebase '${codebaseId}' for workflow run '${runId}': ${err.message}
Cannot safely discover workflows from the run worktree because project workflow files may be missing.
Fix the codebase lookup problem, then retry. What it means
Wrapper for unexpected failures during the codebase lookup step of run actions (resume/approve/reject/respond). Unlike the missing-row case, here getCodebase itself threw; the original error is logged with the runId/codebaseId and rethrown with action-specific context plus the same guidance about workflow discovery.
Source
Thrown at packages/cli/src/commands/workflow.ts:4197
const codebase = await codebaseDb.getCodebase(codebaseId);
if (!codebase) {
throw new Error(
`Workflow run '${runId}' references codebase '${codebaseId}', but that codebase no longer exists.\n` +
'Cannot safely discover workflows from the run worktree because project workflow files may be missing.\n' +
'Re-register the project or restore the codebase row, then retry.'
);
}
return codebase.default_cwd;
} catch (error) {
const err = error as Error;
if (err.message.includes('references codebase')) {
throw err;
}
getLog().error(
{ err, errorType: err.constructor.name, runId, codebaseId },
`cli.workflow_${action}_codebase_lookup_failed`
);
throw new Error(
`Failed to load codebase '${codebaseId}' for workflow run '${runId}': ${err.message}\n` +
'Cannot safely discover workflows from the run worktree because project workflow files may be missing.\n' +
'Fix the codebase lookup problem, then retry.'
);
}
}
/**
* Resume a failed workflow run by ID.
*
* Re-executes the workflow with --resume semantics: `workflowRunCommand` locates
* the prior failed run via findResumableRun and hands it to the executor, which
* skips already-completed nodes (the executor no longer auto-detects on its own).
*
* `runId` may be the short id printed by `workflow runs` (see resolveRunIdArg).
*/
export async function workflowResumeCommand(
runId: string,View on GitHub (pinned to 0773b97458)
Solutions
- Check logs for 'cli.workflow_<action>_codebase_lookup_failed' to see the original error class and message.
- Restore database connectivity (start Postgres / unlock SQLite / fix DSN) and retry the action.
- Verify DB file permissions and that no other process holds an exclusive lock.
- If corruption is suspected, restore the database from backup on a scratch copy and verify.
Defensive patterns
Strategy: retry
Validate before calling
if (!fs.existsSync(workspaceDbPath) || !fs.accessSync(workspaceDbPath, fs.constants.R_OK)) throw new Error('database unavailable before run action'); Try / catch
try { await respond(runId, body); } catch (e) { if (String(e.message).includes('Failed to load codebase')) { await sleep(backoff); return respond(runId, body); } throw e; } Prevention
- Retry transient DB failures with backoff before surfacing to the operator.
- Monitor the 'cli.workflow_<action>_codebase_lookup_failed' log event for root-cause error classes.
- Verify DSN/file-lock health after Postgres restarts or SQLite backup jobs.
When it happens
Trigger: `workflow resume/approve/reject/respond` when codebaseDb.getCodebase throws — DB connection failure, locked SQLite file, driver-level error — while resolving the run's project directory.
Common situations: Database offline or misconfigured DSN, SQLite file permissions/lock contention from another process, corrupted DB page, transient Postgres restart.
Related errors
- Failed to get workflow run: ${err.message}
- Workflow run '${runId}' references codebase '${codebaseId}',
- Cannot create worktree: database lookup failed. Error: ${res
- Cannot create worktree: repository registration failed. Erro
- Cannot execute run '${detachedPreCreatedRun.id}': it belongs
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/c2a1294c95577db0.
Report an issue: GitHub.