{"record":{"id":"a732e5fabb91cd62","repo":"different-ai/openwork","slug":"failed-to-load-the-dashboard-response-status","errorCode":null,"errorMessage":"Failed to load the dashboard (${response.status}).","messagePattern":"Failed to load the dashboard \\((.+?)\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/org-dashboards-data.tsx","lineNumber":204,"sourceCode":"      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,\n      );\n      if (!response.ok) {\n        throw new Error(getErrorMessage(payload, `Failed to load the dashboard (${response.status}).`));\n      }\n      const item = isRecord(payload) ? parseDashboard(payload.item) : null;\n      if (!item) throw new Error(\"The dashboard response was invalid.\");\n      return item;\n    },\n  });\n}\n\nexport function useCreateDashboard() {\n  const queryClient = useQueryClient();\n  const { orgContext, runReauthableAction } = useOrgDashboard();\n  const organizationId = orgContext?.organization.id ?? \"\";\n  return useMutation({\n    mutationFn: async (input: { name: string }): Promise<ManagedDashboard> => {\n      let created: ManagedDashboard | null = null;\n      await runReauthableAction(\"create-dashboard\", async () => {\n        const { response, payload } = await requestJson(\n          \"/v1/dashboards\",","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/org-dashboards-data.tsx#L186-L222","documentation":"useManagedDashboard fetches a single dashboard from GET /v1/dashboards/:id and throws this error when the response is non-ok and the payload has no richer error message. The status code is interpolated so the developer can distinguish auth vs server failures.","triggerScenarios":"Non-2xx from GET /v1/dashboards/{id}: 401 expired session, 403 no access to that dashboard, 404 dashboard deleted or id mistyped, 5xx server error.","commonSituations":"Opening a bookmarked URL for a dashboard that was deleted by an admin; stale list cache pointing at a removed dashboard; insufficient org role; transient Den API outage.","solutions":["Check the interpolated status: 404 → confirm the dashboard id still exists, 401 → re-sign-in, 403 → request access, 5xx → server-side investigation","Refetch the dashboard list and navigate from it instead of a stale deep link","Verify the dashboardId passed to useManagedDashboard is not undefined/empty after encodeURIComponent","Check den-api logs if the status is 5xx"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!dashboardId) {\n  // avoid a doomed request like /v1/dashboards/undefined\n  return;\n}","typeGuard":null,"tryCatchPattern":"const { error } = useManagedDashboard(dashboardId);\nif (error instanceof Error && error.message.includes('(404)')) {\n  showNotFoundAndNavigateBack();\n} else if (error) {\n  showRetry(() => dashboardQuery.refetch());\n}","preventionTips":["Use the useQuery error state instead of assuming data is present","Handle 404 distinctly: navigate back to the list rather than retrying","Avoid deep links to dashboards without verifying they exist via the list query","Enable retry only for transient statuses (5xx, network)"],"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"}