{"record":{"id":"81752aedfd7283f0","repo":"different-ai/openwork","slug":"failed-to-load-workflow-runs-response-status","errorCode":null,"errorMessage":"Failed to load Workflow runs (${response.status}).","messagePattern":"Failed to load Workflow runs \\((.+?)\\)\\.","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/workflow-runs-screen.tsx","lineNumber":61,"sourceCode":"        <span className=\"font-medium text-gray-900\">{run.toolCallCount}</span>\n        {run.toolCalls.length > 0 ? <span className=\"ml-2 break-words text-gray-400\">{run.toolCalls.map((call) => call.name).join(\", \")}</span> : null}\n      </div>\n    ),\n  },\n  { key: \"duration\", header: \"Duration\", render: (run) => <span className=\"text-gray-600\">{formatDuration(run.durationMs)}</span> },\n  { key: \"when\", header: \"When\", render: (run) => <span className=\"whitespace-nowrap text-gray-500\">{new Date(run.createdAt).toLocaleString()}</span> },\n];\n\nexport function WorkflowRunsScreen() {\n  const [runs, setRuns] = useState<WorkflowRun[]>([]);\n  const [loading, setLoading] = useState(true);\n  const [error, setError] = useState<string | null>(null);\n\n  useEffect(() => {\n    let active = true;\n    void requestJson(\"/v1/workflow-runs\", { method: \"GET\" }, 12000)\n      .then(({ response, payload }) => {\n        if (!response.ok) throw new Error(getErrorMessage(payload, `Failed to load Workflow runs (${response.status}).`));\n        if (active) setRuns(getWorkflowRuns(payload));\n      })\n      .catch((reason: unknown) => {\n        if (active) setError(reason instanceof Error ? reason.message : \"Failed to load Workflow runs.\");\n      })\n      .finally(() => {\n        if (active) setLoading(false);\n      });\n    return () => {\n      active = false;\n    };\n  }, []);\n\n  return (\n    <DashboardPageTemplate\n      icon={ScrollText}\n      title=\"Workflow Runs\"\n      description=\"Review recent Workflow run activity and the capabilities each run called.\"","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/workflow-runs-screen.tsx#L43-L79","documentation":"WorkflowRunsScreen fetches GET /v1/workflow-runs in a useEffect and throws 'Failed to load Workflow runs (STATUS).' on non-2xx responses, captured into local error state via getErrorMessage's fallback. The screen renders the message instead of the runs list.","triggerScenarios":"GET /v1/workflow-runs returns 401 (expired Den session), 403 (no membership), 5xx (backend error), or requestJson's 12s timeout elapses; the thrown error is caught and stored via setError.","commonSituations":"Opening the runs screen after a long-idle tab whose session expired, Den server restart, slow network exceeding 12s, org switch invalidating access, or proxy returning 502 for the workflow-runs route.","solutions":["Read the error message shown on screen; check the status code cause.","Re-authenticate if the session expired (401).","Retry the load after confirming connectivity; the effect can be re-run via remount/refresh.","Check Den server/proxy health if the failure is 5xx or timeout.","Verify the user still belongs to an organization with workflow runs."],"exampleFix":"// before\nsetError(reason instanceof Error ? reason.message : \"Failed to load Workflow runs.\");\n// after\nsetError(reason instanceof Error ? reason.message : \"Failed to load Workflow runs.\");\n// plus a Retry button that re-triggers the fetch effect via a nonce state","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"catch ((reason: unknown)) {\n  const msg = reason instanceof Error ? reason.message : \"Failed to load Workflow runs.\";\n  if (/\\((5\\d\\d)|timeout/i.test(msg)) setTimeout(load, 2000); // one soft retry\n  else setError(msg);\n}","preventionTips":["Show a Retry button wired to re-run the fetch effect.","Increase the timeout on slow networks or reduce page size.","Handle 401 by redirecting to sign-in instead of showing a raw error.","Guard state updates with the `active` flag (already done) to avoid setState after unmount."],"tags":["http","react","network","data-loading"],"backgroundTag":"http-request-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}