coleam00/Archon · error · Error

Cannot supersede run '${superseded.id}': it is still ${super

Error message

Cannot supersede run '${superseded.id}': it is still ${superseded.status}.

What it means

resolveSupersededRun() only permits superseding runs already in a terminal status (TERMINAL_WORKFLOW_STATUSES). If the referenced run exists but is still running/pending/approving, the CLI throws this refusal naming the run id and its current status, preventing a new run from superseding live work.

Source

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

      `Error: ${error.message}\n` +
      'Hint: Check your database connection before using --resume.'
  );
}

/**
 * Validate a `--supersedes` declaration (#2747): the run must exist and be terminal.
 * Supersede inherits nothing, so existence and terminality are the whole contract.
 *
 * One owner for the refusals because two callers need them: the `--detach` pre-flight,
 * which refuses before forking (#2872), and the run path that records the provenance.
 */
async function resolveSupersededRun(runId: string): Promise<WorkflowRun> {
  const superseded = await workflowDb.getWorkflowRun(runId);
  if (!superseded) {
    throw new Error(`Cannot supersede: no workflow run '${runId}' exists.`);
  }
  if (!TERMINAL_WORKFLOW_STATUSES.includes(superseded.status)) {
    throw new Error(`Cannot supersede run '${superseded.id}': it is still ${superseded.status}.`);
  }
  return superseded;
}

/**
 * The acting CLI user's Archon id, or undefined when `ARCHON_USER_ID`/`$USER` is unset
 * or the identity cannot be resolved. Attribution is best-effort by design — a run must
 * not fail because the user table could not be reached.
 */
async function resolveCliUserRecordId(): Promise<string | undefined> {
  const cliId = resolveCliUserId();
  if (!cliId) return undefined;
  try {
    const cliUser = await userDb.findOrCreateUserByPlatformIdentity('cli', cliId, cliId);
    return cliUser.id;
  } catch (error) {
    getLog().warn({ err: error as Error, cliId }, 'cli.user_identity_resolve_failed');
    return undefined;

View on GitHub (pinned to 0773b97458)

Solutions

  1. Cancel the active run first (`archon workflow cancel <runId>`) or wait for it to reach a terminal status.
  2. Resume the stuck run (`archon workflow resume <runId>`) if it is in a durable wait rather than superseding.
  3. Approve/reject any pending gate so the run finishes, then re-run with --supersede.
  4. If the run is genuinely orphaned with a non-terminal status, follow the operator flow for ambiguous ownership rather than superseding.

Example fix

// before
$ archon workflow run foo --supersede wf_123
Error: Cannot supersede run 'wf_123': it is still running.
// after
$ archon workflow cancel wf_123
$ archon workflow run foo --supersede wf_123
Defensive patterns

Strategy: validation

Validate before calling

// only supersede runs already in a terminal status
import { workflowDb, TERMINAL_WORKFLOW_STATUSES } from '@archon/core';
const run = await workflowDb.getWorkflowRun(runId);
if (run && !TERMINAL_WORKFLOW_STATUSES.includes(run.status)) {
  throw new Error(`Run ${runId} is still ${run.status}; cancel or wait first.`);
}

Type guard

function isTerminal(status: string, terminal: readonly string[]): boolean {
  return terminal.includes(status);
}

Try / catch

try {
  await runWorkflow(name, { supersede: runId });
} catch (e) {
  const msg = String((e as Error).message);
  if (msg.includes('it is still')) {
    console.error('Target run is active: cancel it (`archon workflow cancel`) or wait for it to finish.');
  }
}

Prevention

When it happens

Trigger: Passing --supersede <runId> for a run whose status is not terminal — e.g. it is still 'running', 'waiting' (durable wait), or blocked at a human approval gate.

Common situations: Re-running a workflow while the previous invocation is still executing; superseding a run paused at an approval gate; a stale/crashed run that still shows a non-terminal status and should instead be cancelled or resumed.

Related errors


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