coleam00/Archon · error · WorkflowRunFailedError
result.error
Error message
result.error
What it means
When a workflow completes unsuccessfully, the CLI throws `WorkflowRunFailedError(result.error, detachedProcessOwner)` (packages/cli/src/utils/workflow-exit-code.ts:8), carrying the workflow's error string and the detached flag; `resolveCliExitCode` maps it to a distinct exit code (including DETACHED_RUN_FAILED_EXIT_CODE) so wrappers can detect failure programmatically.
Source
Thrown at packages/cli/src/commands/workflow.ts:3213
// Surface workflow result to Web UI as a result card (mirrors orchestrator.ts result message).
// Paused workflows are handled in the branch above and intentionally do not get a result card.
if ('summary' in result && result.summary) {
try {
await adapter.sendMessage(conversationId, result.summary, {
category: 'workflow_result',
segment: 'new',
workflowResult: { workflowName: workflow.name, runId: result.workflowRunId },
});
} catch (surfaceError) {
getLog().warn(
{ err: surfaceError as Error, conversationId },
'cli.workflow_result_surface_failed'
);
}
}
console.log('\nWorkflow completed successfully.');
} else {
throw new WorkflowRunFailedError(result.error, detachedProcessOwner);
}
}
/**
* Run a specific workflow.
*
* A thin owner around the implementation: whatever the run does with its captured source,
* the capture is either adopted by a run or reclaimed. The implementation has a dozen
* ordinary ways out — unknown workflow, refused inputs, flag conflicts, a detached
* dispatch — and asking each to remember a disposal call is how most of them did not.
*/
export async function workflowRunCommand(
cwd: string,
workflowName: string,
userMessage: string,
options: WorkflowRunOptions = {}
): Promise<void> {
try {View on GitHub (pinned to 0773b97458)
Solutions
- Read the workflow's error text (from result.error, shown in output) and fix the underlying node-level cause.
- Re-run the workflow after fixing; completed nodes are reused on resume where supported.
- In detached mode, inspect the run-control status/log for the failed run before retrying.
- Wrap invocations expecting possible failure: catch `WorkflowRunFailedError` and map its exit code via `resolveCliExitCode`.
Example fix
// before
try { await runWorkflowCommand(...) } catch (e) { console.error(e) }
// after
import { WorkflowRunFailedError, resolveCliExitCode } from '../utils/workflow-exit-code';
try {
await runWorkflowCommand(...);
} catch (e) {
if (e instanceof WorkflowRunFailedError) {
console.error(`Workflow failed: ${e.message}`);
process.exitCode = resolveCliExitCode(e);
} else throw e;
} Defensive patterns
Strategy: try-catch
Type guard
function isWorkflowRunFailedError(e: unknown): e is WorkflowRunFailedError {
return e instanceof WorkflowRunFailedError;
} Try / catch
try {
await runWorkflowCommand(...);
} catch (e) {
if (isWorkflowRunFailedError(e)) {
console.error(`Workflow failed: ${e.message}`);
process.exitCode = resolveCliExitCode(e);
} else {
throw e;
}
} Prevention
- Inspect the workflow's reported error (node output) before re-running.
- Fix failing node scripts/providers, then resume to reuse completed nodes.
- Handle the detached-failure exit code distinctly in wrappers/CI.
- Validate node inputs (paths, env vars) before the run to reduce node-level failures.
When it happens
Trigger: `executeWorkflow` returns `result.success === false`: a node failed, retries exhausted, a gate was rejected, or an infrastructure error failed the run — the CLI surfaces it as this typed error.
Common situations: A bash node exited non-zero; an AI node exhausted retries; a human gate was rejected; docker/network failure inside a node became a permanent run failure.
Related errors
- Cannot execute run '${detachedPreCreatedRun.id}': it belongs
- Dry-run failed; missing stubs: ${blockingMissingStubs.join('
- Failed to get workflow run: ${err.message}
- --open and --status are mutually exclusive: the inbox is fai
- Invalid --status '${opts.status}'. Valid: ${workflowRunStatu
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/bab68e765eeb42ad.
Report an issue: GitHub.