{"record":{"id":"b50157b70f514ea4","repo":"paperclipai/paperclip","slug":"the-stop-was-requested-but-stopping-could-not-be-verified","errorCode":null,"errorMessage":"The stop was requested, but stopping could not be verified. Refresh and try Stop again if work is still running.","messagePattern":"The stop was requested, but stopping could not be verified\\. Refresh and try Stop again if work is still running\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ui/src/lib/wait-for-stopped-runs.ts","lineNumber":31,"sourceCode":") {\n  const getRun = options.getRun ?? heartbeatsApi.get;\n  const deadline = Date.now() + (options.timeoutMs ?? 30_000);\n  let remaining = [...new Set(runIds)];\n  while (remaining.length > 0) {\n    let states;\n    let timeout: ReturnType<typeof setTimeout> | undefined;\n    try {\n      states = await Promise.race([\n        Promise.all(remaining.map((id) => getRun(id))),\n        new Promise<never>((_resolve, reject) => {\n          timeout = setTimeout(\n            () => reject(new Error(\"Stop verification timed out\")),\n            Math.max(0, deadline - Date.now()),\n          );\n        }),\n      ]);\n    } catch {\n      throw new Error(\n        \"The stop was requested, but stopping could not be verified. Refresh and try Stop again if work is still running.\",\n      );\n    } finally {\n      clearTimeout(timeout);\n    }\n    remaining = states\n      .filter((run) => {\n        if (LIVE_STATUSES.has(run.status)) return true;\n        const adapterCancellation = run.resultJson?.executionCancellation;\n        if (adapterCancellation && typeof adapterCancellation === \"object\"\n          && \"state\" in adapterCancellation && adapterCancellation.state !== \"acknowledged\") return true;\n        if (!(\"runtimeMode\" in run) || run.runtimeMode !== \"native\" || run.status !== \"cancelled\")\n          return false;\n        const cancellation = run.resultJson?.nativeCancellation;\n        return (\n          !cancellation ||\n          typeof cancellation !== \"object\" ||\n          !(\"dispatchState\" in cancellation) ||","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/ui/src/lib/wait-for-stopped-runs.ts#L13-L49","documentation":"`waitForStoppedRuns` races per-run stop polling against a deadline; if the underlying wait/poll promise rejects (e.g. the internal 'Stop verification timed out' timer or a polling request failure), it replaces the error with this user-facing message telling the operator to refresh and retry Stop. The stop request was dispatched but the UI could not confirm the runs actually stopped.","triggerScenarios":"Runs remain non-stopped past the deadline because the internal timeout fired, or a state-poll request threw while verifying cancellation acknowledgement.","commonSituations":"Runner/agent process ignoring cancellation signals; backend slow to transition run dispatch state to acknowledged; network hiccup during the verification poll window.","solutions":["Refresh the board and check run states; issue Stop again if work is still running.","Check server logs for cancellation dispatch/acknowledgement failures for the affected run ids.","If this recurs, increase the verification deadline/interval options passed to waitForStoppedRuns."],"exampleFix":"// before\nawait waitForStoppedRuns(runIds);\n// after\ntry { await waitForStoppedRuns(runIds, { deadlineMs: 30000, intervalMs: 500 }); }\ncatch (e) { showToast(String(e.message)); }","handlingStrategy":"try-catch","validationCode":"const states = await fetchRunStates(ids); if (states.every(isStopped)) return; // already stopped","typeGuard":"const isStopped = (r: RunState) => r.cancellation?.dispatchState === 'acknowledged' || r.status === 'stopped';","tryCatchPattern":"try { await waitForStoppedRuns(ids); } catch (e) { showToast(e.message); /* advise refresh + retry Stop */ }","preventionTips":["Verify runs are already stopped before calling.","Use generous deadlines for long-running agents.","Surface the error verbatim so users follow the refresh/retry guidance."],"tags":["timeout","cancellation","polling"],"backgroundTag":"request-timeout","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}