{"record":{"id":"b8d0928374848cfd","repo":"different-ai/openwork","slug":"failed-to-load-dashboards-response-status","errorCode":null,"errorMessage":"Failed to load dashboards (${response.status}).","messagePattern":"Failed to load dashboards \\((.+?)\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/org-dashboards-data.tsx","lineNumber":183,"sourceCode":"  return {\n    ...element,\n    connectionId: element.connectionId,\n    description: readString(value.description),\n    requiresInput: value.requiresInput === true,\n    requiresApproval: value.requiresApproval === true,\n  };\n}\n\nexport function useManagedDashboards() {\n  const { orgContext } = useOrgDashboard();\n  const organizationId = orgContext?.organization.id ?? \"\";\n  return useQuery({\n    enabled: Boolean(organizationId),\n    queryKey: orgDashboardsQueryKeys.list(organizationId),\n    queryFn: async (): Promise<ManagedDashboard[]> => {\n      const { response, payload } = await requestJson(\"/v1/dashboards\", { method: \"GET\" }, 15000);\n      if (!response.ok) {\n        throw new Error(getErrorMessage(payload, `Failed to load dashboards (${response.status}).`));\n      }\n      const items = isRecord(payload) && Array.isArray(payload.items) ? payload.items : [];\n      return items.map(parseDashboard).filter((item): item is ManagedDashboard => item !== null);\n    },\n  });\n}\n\nexport function useManagedDashboard(dashboardId: string) {\n  const { orgContext } = useOrgDashboard();\n  const organizationId = orgContext?.organization.id ?? \"\";\n  return useQuery({\n    enabled: Boolean(organizationId && dashboardId),\n    queryKey: orgDashboardsQueryKeys.detail(organizationId, dashboardId),\n    queryFn: async (): Promise<ManagedDashboard> => {\n      const { response, payload } = await requestJson(\n        `/v1/dashboards/${encodeURIComponent(dashboardId)}`,\n        { method: \"GET\" },\n        15000,","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/org-dashboards-data.tsx#L165-L201","documentation":"useManagedDashboards fetches GET /v1/dashboards via requestJson and throws this error when the HTTP response is not ok and the payload carries no more specific message (getErrorMessage falls back to this template). It is a generic HTTP-failure wrapper that embeds the status code.","triggerScenarios":"Any non-2xx status from GET /v1/dashboards: 401 (expired Den session), 403 (not an org member), 404 (wrong API base path), 5xx (server error), or a 15s timeout path producing a non-ok response.","commonSituations":"Session cookie expired after idle; user's role lacks dashboard read permission; self-hosted server version without the /v1/dashboards route; Den API pod crashing under load.","solutions":["Read the status code in the message: 401 → re-authenticate, 403 → request org permissions, 404 → check API base URL/version, 5xx → check server logs","Refresh the page / re-sign-in to renew the Den session","Confirm the app is pointed at the correct den-api base URL for the environment","If 5xx persists, check den-api server logs and dashboards table health"],"exampleFix":"// before\nif (!response.ok) {\n  throw new Error(getErrorMessage(payload, `Failed to load dashboards (${response.status}).`));\n}\n// after\nif (!response.ok) {\n  if (response.status === 401) await reauthenticate();\n  throw new Error(getErrorMessage(payload, `Failed to load dashboards (${response.status}).`));\n}","handlingStrategy":"try-catch","validationCode":"// pre-flight session check before mounting queries\nconst session = await fetch('/v1/session', { method: 'GET' });\nif (!session.ok) { redirectToSignIn(); }","typeGuard":null,"tryCatchPattern":"const { isLoading, error } = useManagedDashboards(organizationId);\nif (error) {\n  const msg = error instanceof Error ? error.message : 'Unknown error';\n  if (msg.includes('(401)')) redirectToSignIn();\n  else if (msg.includes('(403)')) showNoPermission();\n  else showRetryBanner(msg, () => refetch());\n}","preventionTips":["Surface status-specific UI (re-auth vs retry vs permissions) using the interpolated status code","Wrap query calls so 401 triggers a global re-auth flow","Add retry with backoff for 5xx only, never for 4xx","Monitor den-api for spikes of this error to catch server regressions"],"tags":["http","network","api","react-query"],"backgroundTag":"http-error-response","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}