coleam00/Archon · error · Error
Cannot actively cancel run with status '${current.status}'.
Error message
Cannot actively cancel run with status '${current.status}'. Only a running detached CLI run has live work to stop. What it means
The active-cancel operation only stops live detached CLI work, so it refuses runs whose status is not `running`. A run in `completed`, `failed`, `cancelled`, `paused`, etc. has no live process to stop; the run state is left untouched.
Source
Thrown at packages/cli/src/commands/workflow.ts:4395
* tree, then record `cancelled`. An unreachable owner never falls back to a DB-only
* transition — operators use `abandon` separately after verifying an orphan.
*/
export async function workflowCancelCommand(
runId: string,
json?: boolean,
cwd?: string
): Promise<void> {
const cancel = async (): Promise<{
resolvedId: string;
workflowName: string;
cascadeFailures: number;
blockedParentRunId: string | null;
}> => {
const resolvedId = await resolveRunIdArg(runId, cwd);
const current = await workflowDb.getWorkflowRun(resolvedId);
if (!current) throw new Error(`Workflow run not found: ${resolvedId}`);
if (current.status !== 'running') {
throw new Error(
`Cannot actively cancel run with status '${current.status}'. Only a running detached CLI run has live work to stop.`
);
}
let containerEnvId: string | undefined;
if (current.metadata?.isolation === 'container') {
const isolationEnvId = current.metadata.isolation_env_id;
if (typeof isolationEnvId !== 'string' || isolationEnvId.trim().length === 0) {
throw new Error(
`Cannot confirm the isolation container owned by run ${resolvedId}. ` +
'The run was not changed; its container tracking ID is missing.'
);
}
containerEnvId = isolationEnvId;
const containerEnv = await isolationDb.getById(containerEnvId);
if (containerEnv?.provider !== 'container') {
throw new Error(
`Cannot confirm the isolation container owned by run ${resolvedId}. ` +View on GitHub (pinned to 0773b97458)
Solutions
- Check the run's current status (`archon workflow status <id>`); if it is finished/cancelled, no action is needed
- For a gated/paused run use the appropriate command (`approve`/`reject`) instead of cancel
- Only actively cancel runs that show `running` with a live detached owner process
Example fix
// before
await cancelWorkflow(runId);
// after
const run = await getWorkflowRun(runId);
if (run.status === 'running') await cancelWorkflow(runId);
else console.log(`run is ${run.status}; nothing to cancel`); Defensive patterns
Strategy: validation
Validate before calling
const run = await workflowDb.getWorkflowRun(id);
if (run?.status !== 'running') {
console.log(`run is ${run?.status}; only running detached runs can be actively cancelled`);
return;
}
await cancelWorkflow(id); Type guard
const isRunning = (r: { status: string }): boolean => r.status === 'running'; Prevention
- Check current run status before cancelling
- Use approve/reject for gated or paused runs, not cancel
- Treat cancel as idempotent-no-op for terminal states in scripts
When it happens
Trigger: Calling `archon workflow cancel <id>` on a run whose `status !== 'running'` — e.g. cancelling an already-finished or already-cancelled run, or a paused/gated run.
Common situations: Double-cancelling after a prior cancel succeeded; trying to cancel a run that already completed while you read an old status; attempting to use cancel on a waiting-on-gate run that needs `approve`/`reject` instead.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Workflow run not found: ${resolvedId}
- Cannot confirm the isolation container owned by run ${resolv
- Cannot confirm the isolation container owned by run ${resolv
- Detached owner process stopped, but the isolation container
- Detached work stopped, but cancellation did not win the run
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/5d9673bf4e2d3170.
Report an issue: GitHub.