coleam00/Archon · error

Failed to resolve approval gate: ${err.message}

Error message

Failed to resolve approval gate: ${err.message}

What it means

Error "Failed to resolve approval gate: ${err.message}" thrown in coleam00/Archon.

Source

Thrown at packages/core/src/db/workflows.ts:270

    return await getDatabase().withTransaction(async query => {
      const result = await query(
        `UPDATE remote_agent_workflow_runs
         SET metadata = ${dialect.jsonMerge('metadata', 2)}
         WHERE id = $1 AND ${unresolvedGateClause()}`,
        [id, JSON.stringify(metadata)]
      );
      const resolved = (result.rowCount ?? 0) > 0;
      if (resolved) {
        for (const event of events) {
          await insertWorkflowEvent(query, { workflow_run_id: id, ...event });
        }
      }
      return { resolved };
    });
  } catch (error) {
    const err = error as Error;
    getLog().error({ err, workflowRunId: id }, 'db.workflow_run_resolve_gate_failed');
    throw new Error(`Failed to resolve approval gate: ${err.message}`);
  }
}

/**
 * Atomically cancel a paused approval gate (compare-and-swap).
 *
 * The reject sibling of resolveApprovalGate for the outcomes that TERMINATE the
 * run (no on_reject prompt, or the attempt cap reached): it flips the run
 * paused→'cancelled' in a SINGLE conditional UPDATE, guarded on the SAME
 * open-gate predicate. Doing it in one statement (instead of stamp-resolution +
 * separate cancelWorkflowRun) means there is never an intermediate
 * resolved-but-not-cancelled state that a failed second write could strand — a
 * reject retry could not self-heal past the fast-path gate guard. No `resolved`
 * marker is written: that marker only matters for the stay-paused rework path,
 * and the rejection reason is preserved in the approval_received event.
 *
 * Writes `workflow_cancelled` itself (#2906) rather than trusting the caller to
 * pass it: this is a terminal status write, and every other terminal writer here

View on GitHub (pinned to 0773b97458)

When it happens

Trigger: Thrown at packages/core/src/db/workflows.ts:270 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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