Skip to Content
Runlane
Build with RunlaneControl work

Retry and rerun runs

Retry failed work or create a new run from terminal work.

Use manual retry for a failed run after its cause has been fixed. Use rerun when you intentionally want a new execution of any terminal run.

src/runlane/run-operations.ts
import { queue, type RunlaneRuntime } from '@runlane/core'

const recoveryQueue = queue({ name: 'recovery' })

export async function retryFailedRun(runlane: RunlaneRuntime, failedRunId: string) {
  return runlane.runs.retry(failedRunId)
}

export async function rerunTerminalRun(runlane: RunlaneRuntime, sourceRunId: string) {
  return runlane.runs.rerun(sourceRunId)
}

export async function rerunInRecoveryQueue(runlane: RunlaneRuntime, sourceRunId: string) {
  return runlane.runs.rerun(sourceRunId, {
    queue: recoveryQueue,
    runId: 'run.recovery.2026-01-15',
  })
}

Retry a failed run

The source must be failed. Runlane creates a queued child with the source task and payload and records a manual-retry source link. The failed source remains unchanged for audit history.

Rerun terminal work

The source must be terminal. Rerun also creates a queued child and leaves the original untouched.

Both methods accept an optional queue override, operator actor metadata, and an explicit plain-string child run ID. rerunInRecoveryQueue() shows the queue and run-id overrides.

The source task must still be registered so Runlane can resolve its handler, queue, concurrency, and singleton policies. The child reuses the source run's saved validated payload without applying the input schema again.

Both methods create a new run with a new ID. If the source has an idempotency key, creation atomically acquires that key in the same environment and task scope. Later same-key triggers return the new run. The source keeps its historical key field but no longer owns the key. Task key callbacks do not replace the saved source key.

Rerun can replace its source's retained owner, preserving its captured TTL. A key without a remaining source owner is acquired with the current task TTL, or the shared default when omitted. Active owners never expire by TTL. The new run follows normal terminal retention, including saved final results after automatic deletion. A different live or retained owner causes storage_conflict; Runlane creates nothing and leaves that owner unchanged. Singleton and concurrency policies still apply, and the source singleton key is preserved.

To verify the action, confirm the returned child is queued, its source.sourceRunId names the original, and the original record is unchanged. Then let the normal worker or delivery path execute the child.

retry() rejects a non-failed source. rerun() rejects an active source. task_not_found means the operator runtime does not have the source task registered. Fix the runtime catalog rather than copying the payload into an unrelated trigger.

Use automatic retries for transient failures handled by policy rather than an operator.

On this page