paperclipai/paperclip · error

Failed run is no longer available.

Error message

Failed run is no longer available.

What it means

retryFailedRun in IssueDetail looks up the run to retry in resolvedLinkedRuns by runId. If the run is no longer present in the issue's linked runs (deleted, unlinked, or the list is stale), the mutation throws this error instead of calling agentsApi.wakeup. It guards against retrying a run the issue no longer references.

Source

Thrown at ui/src/pages/IssueDetail.tsx:1510

    setDiscardedQueuedCommentIds(new Set());
  }, [issueId]);
  useEffect(() => {
    setLocalSteeringPlacements(new Map());
  }, [issueId]);
  const hasLiveRuns = liveRunCount > 0 || !!resolvedActiveRun;
  const { data: linkedRuns, isPending: linkedRunsPending, isError: linkedRunsError, refetch: refetchLinkedRuns } = useQuery({
    queryKey: queryKeys.issues.runs(issueId),
    queryFn: () => activityApi.runsForIssue(issueId),
    refetchInterval:
      hasLiveRuns || issueStatus === "in_progress" ? 1000 : false,
    placeholderData: keepPreviousDataForSameQueryTail<RunForIssue[]>(issueId),
  });
  const resolvedActivity = activity ?? [];
  const resolvedLinkedRuns = linkedRuns ?? [];
  const retryFailedRun = useMutation({
    mutationFn: async (runId: string) => {
      const failedRun = resolvedLinkedRuns.find((run) => run.runId === runId);
      if (!failedRun) throw new Error("Failed run is no longer available.");
      const result = await agentsApi.wakeup(
        failedRun.agentId,
        {
          source: "on_demand",
          triggerDetail: "manual",
          reason: "retry_failed_run",
          payload: { issueId },
        },
        companyId,
      );
      if (!("id" in result)) {
        throw new Error(result.message ?? "Retry was skipped.");
      }
      return result;
    },
    onSuccess: () => {
      queryClient.invalidateQueries({
        queryKey: queryKeys.issues.runs(issueId),

View on GitHub (pinned to 01ad858492)

Solutions

  1. Invalidate/refetch the issue's linked runs and retry once the list is current.
  2. Verify the run still exists (it may have been deleted or unlinked from the issue) and pick the current entry.
  3. Guard the Retry button on the run being present in the current linkedRuns data.
  4. If the linked-runs query errored, surface that error instead of silently using the empty fallback.

Example fix

// before
const failedRun = resolvedLinkedRuns.find((run) => run.runId === runId);
if (!failedRun) throw new Error("Failed run is no longer available.");
// after (refresh then retry)
const failedRun = resolvedLinkedRuns.find((run) => run.runId === runId);
if (!failedRun) {
  await queryClient.invalidateQueries({ queryKey: queryKeys.issues.runs(issueId) });
  throw new Error("Failed run is no longer available.");
}
Defensive patterns

Strategy: validation

Validate before calling

const failedRun = resolvedLinkedRuns.find((run) => run.runId === runId);
if (!failedRun) {
  await queryClient.invalidateQueries({ queryKey: queryKeys.issues.runs(issueId) });
  toast.info("Run list refreshed — retry again if the run is still listed.");
  return;
}

Type guard

const isLinked = (runs: { runId: string }[], id: string) => runs.some((r) => r.runId === id);

Try / catch

try {
  await retryFailedRun.mutateAsync(runId);
} catch (e) {
  toast.error(e.message);
  await queryClient.invalidateQueries({ queryKey: queryKeys.issues.runs(issueId) });
}

Prevention

When it happens

Trigger: retryFailedRun.mutate(runId) with a runId not found in resolvedLinkedRuns — the linked-runs query returned data without that run (stale cache, run deleted, or list not yet loaded when resolvedLinkedRuns defaulted to []).

Common situations: Clicking Retry on an outdated activity/linked-run entry after another actor removed the run; the linked-runs query failed or was still loading so the fallback empty array was used; issue data refreshed between render and click.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10). Data as JSON: /api/errors/37ff63b49d9f030b. Report an issue: GitHub.