paperclipai/paperclip · error · Error

The stop was requested, but work is still stopping. Try…

Error message

The stop was requested, but work is still stopping. Try Stop again if it continues.

What it means

After filtering, if some runs still report a non-acknowledged cancellation dispatch state and the deadline has passed, `waitForStoppedRuns` throws this message: the stop was requested but work is demonstrably still stopping/unstopped at timeout. Unlike 518 this is the deliberate deadline expiry path, not a wrapped inner failure.

Solutions

  1. Wait briefly and try Stop again as the message suggests; check the Activity/run log for dispatch state transitions.
  2. Increase `deadlineMs` (or options) at call sites where long-running runs are common.
  3. Investigate the server-side cancellation path if dispatch state stays unacknowledged indefinitely.

Example fix

// before
await waitForStoppedRuns(ids, { deadlineMs: 8000 });
// after
await waitForStoppedRuns(ids, { deadlineMs: 30000, intervalMs: 1000 });
Defensive patterns

Strategy: retry

Validate before calling

const states = await fetchRunStates(ids); const pending = states.filter((r) => r.cancellation?.dispatchState !== 'acknowledged'); if (pending.length === 0) return;

Type guard

const isAcknowledged = (r: RunState): boolean => r.cancellation?.dispatchState === 'acknowledged';

Try / catch

for (let i = 0; i < 2; i++) { try { await waitForStoppedRuns(ids); break; } catch { if (i === 1) showToast('Work still stopping — check Activity'); await sleep(2000); } }

Prevention

When it happens

Trigger: Poll loop reaches `Date.now() >= deadline` while `remaining` is non-empty — runs whose cancellation.dispatchState never became 'acknowledged' within the deadline.

Common situations: Long-running agent runs that take longer than the deadline to cancel; backend backlog in processing cancellation; stale poll responses making runs look unacknowledged.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/e33fc7a89a86cefd. Report an issue: GitHub.

Appendix: source

Thrown at ui/src/lib/wait-for-stopped-runs.ts:56

      .filter((run) => {
        if (LIVE_STATUSES.has(run.status)) return true;
        const adapterCancellation = run.resultJson?.executionCancellation;
        if (adapterCancellation && typeof adapterCancellation === "object"
          && "state" in adapterCancellation && adapterCancellation.state !== "acknowledged") return true;
        if (!("runtimeMode" in run) || run.runtimeMode !== "native" || run.status !== "cancelled")
          return false;
        const cancellation = run.resultJson?.nativeCancellation;
        return (
          !cancellation ||
          typeof cancellation !== "object" ||
          !("dispatchState" in cancellation) ||
          cancellation.dispatchState !== "acknowledged"
        );
      })
      .map((run) => run.id);
    if (remaining.length === 0) return;
    if (Date.now() >= deadline) {
      throw new Error(
        "The stop was requested, but work is still stopping. Try Stop again if it continues.",
      );
    }
    await new Promise((resolve) =>
      setTimeout(resolve, options.intervalMs ?? 500),
    );
  }
}

View on GitHub (pinned to 3f1d897a7c)