Skip to main content

CLEAR STUCK RUNS

This guide shows you how to find runs that are stuck or orphaned and clear them so new executions can proceed.

Prerequisites

  • Swamp installed and on your PATH
  • An initialised repo (swamp repo init)

1. Check what is running

swamp run history --active

If runs are in progress, you will see output like:

STATUS   KIND    NAME                   ID        AGE  PID    HOST
running  method  command/shell/execute  cc665a58  3s   18669  Mac.localdomain

A stale run — one whose process has crashed — shows a [STALE] marker:

STATUS           KIND    NAME                   ID        AGE  PID    HOST
running [STALE]  method  command/shell/execute  58bb2b7f  2m   31822  Mac.localdomain

If nothing is running, the output is No tracked runs.

2. Diagnose stale runs

swamp run doctor

The doctor identifies stale runs and reports them:

1 stale run(s) detected:
KIND    NAME                   ID        HEARTBEAT AGE  PID    HOST
method  command/shell/execute  58bb2b7f  2m            31822  Mac.localdomain

Run with --fix to automatically reap stale runs.

If there are no stale or active runs:

No active or stale runs.

3. Clear stale runs

To reap the stale runs the doctor found:

swamp run doctor --fix
1 stale run(s) detected:
KIND    NAME                   ID        HEARTBEAT AGE  PID    HOST
method  command/shell/execute  58bb2b7f  2m            31822  Mac.localdomain

Reaped 1 stale run(s).

4. Verify the fix

swamp run history --active

The stale run no longer appears. It has been transitioned to failed in the run history.

On a remote server

If the stuck run is executing on a swamp serve instance, pass the server URL:

swamp run doctor --server ws://host:9090 --token mytoken.secret

The doctor checks the server's local run tracker rather than the local one. swamp run history --server works the same way.

Next steps