coleam00/Archon · critical · Error
Failed to create the workflow run: ${(error as Error).messag
Error message
Failed to create the workflow run: ${(error as Error).message}
Nothing was started. What it means
Thrown when `workflowDb.createWorkflowRun` fails while pre-creating the run row for a fresh detached launch. The CLI intentionally writes the row before forking the child so that 'Started' guarantees a queryable run; if the insert fails, nothing has been spawned yet, so the error states 'Nothing was started'. The underlying error message is embedded for diagnosis.
Source
Thrown at packages/cli/src/commands/workflow.ts:2135
metadata: {
// Declared inputs (#2554): `$INPUTS` is read off the row, so a pre-created
// row that omits them starts a run whose inputs silently disappeared.
...(resolvedInputs && Object.keys(resolvedInputs).length > 0
? { [SUBRUN_METADATA_KEYS.inputs]: { ...resolvedInputs } }
: {}),
...(continuationDeclaration
? { [CONTINUATION_METADATA_KEY]: { mode: continuationDeclaration.mode } }
: {}),
},
...(detachedUserId ? { user_id: detachedUserId } : {}),
...(continuationDeclaration
? { adopted_from_run_id: continuationDeclaration.runId }
: {}),
});
detachedRunId = created.id;
launchedRunId = created.id;
} catch (error) {
throw new Error(
`Failed to create the workflow run: ${(error as Error).message}\nNothing was started.`
);
}
}
// Pin a generated branch only when isolating AND the caller didn't pass
// --branch (an explicit --branch is already in argv). Without this, the child
// would generate its own timestamped branch and fork a second worktree.
// Never pin a branch for folder projects — they run in place with no worktree.
if (
wantsIsolation &&
!detachIsFolder &&
options.branchName === undefined &&
options.adoptRunId === undefined
) {
pinnedBranch = `${workflowName}-${String(Date.now())}`;
extraArgs.push('--branch', pinnedBranch);
}
// Pin the conversation id only when generated (an explicit one is already in argv).View on GitHub (pinned to 0773b97458)
Solutions
- Read the embedded message to identify the underlying DB error.
- Verify the database is still up and DATABASE_URL is correct.
- Run schema initialization/upgrade so the workflow_runs table matches the binary's expectations.
- If adopting/superseding, confirm the referenced run id exists in the database.
- Retry the launch once the database is healthy.
Example fix
// before archon workflow run my-flow --detach # Failed to create the workflow run: relation "workflow_runs" does not exist // after bun run db:init # or the project's schema-init command archon workflow run my-flow --detach
Defensive patterns
Strategy: try-catch
Validate before calling
await db.execute(sql`select 1 from workflow_runs limit 1`); // schema + connectivity probe const prior = adoptedRunId ? await workflowDb.getWorkflowRun(adoptedRunId) : null; // FK target exists
Try / catch
try {
created = await workflowDb.createWorkflowRun({...});
} catch (error) {
const msg = (error as Error).message;
console.error(`Run-row insert failed: ${msg}. Nothing was started; fix the DB and retry.`);
process.exit(1);
} Prevention
- Run schema init/migrations after every upgrade before launching runs.
- Confirm adopted/superseded run ids exist before passing them.
- Monitor database uptime for long-running CLI sessions.
- Keep binary and schema versions aligned.
When it happens
Trigger: Calling the workflow run command with detachment enabled when the run-row insert fails: database unreachable mid-command, NOT NULL/foreign-key violation (e.g. invalid conversation id or user id), schema mismatch from an older binary, or a constraint on adopted_from_run_id.
Common situations: Database went down between the conversation lookup and the insert; schema drift after an upgrade where the new metadata column is absent; adopting a run id that violates a foreign key.
Related errors
- Cannot create worktree: database lookup failed. Error: ${res
- Cannot create worktree: repository registration failed. Erro
- Failed to access database: ${err.message} Hint: Check that D
- Cannot resume: Database lookup failed. Error: ${codebaseLook
- Failed to update conversation: ${err.message}
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/4e31f2981609ddb4.
Report an issue: GitHub.