different-ai/openwork · error
Failed to load dashboard access (${response.status}).
Error message
Failed to load dashboard access (${response.status}). What it means
useDashboardAccess fetches GET /v1/dashboards/:id/access and throws this error for any non-ok response when the payload lacks a specific message. The grants list cannot be loaded, so the access-management UI shows the query error state.
Source
Thrown at ee/apps/den-web/app/(den)/dashboard/_components/org-dashboards-data.tsx:307
queryClient.invalidateQueries({ queryKey: orgDashboardsQueryKeys.list(organizationId) });
},
});
}
export function useDashboardAccess(dashboardId: string) {
const { orgContext } = useOrgDashboard();
const organizationId = orgContext?.organization.id ?? "";
return useQuery({
enabled: Boolean(organizationId && dashboardId),
queryKey: orgDashboardsQueryKeys.access(organizationId, dashboardId),
queryFn: async (): Promise<DashboardAccessGrant[]> => {
const { response, payload } = await requestJson(
`/v1/dashboards/${encodeURIComponent(dashboardId)}/access`,
{ method: "GET" },
15000,
);
if (!response.ok) {
throw new Error(getErrorMessage(payload, `Failed to load dashboard access (${response.status}).`));
}
const items = isRecord(payload) && Array.isArray(payload.items) ? payload.items : [];
return items
.map(parseAccessGrant)
.filter((grant): grant is DashboardAccessGrant => grant !== null && grant.removedAt === null);
},
});
}
type GrantDashboardAccessBody =
| { orgMembershipId: string; teamId?: never; orgWide?: never; role: DashboardAccessRole }
| { orgMembershipId?: never; teamId: string; orgWide?: never; role: DashboardAccessRole }
| { orgMembershipId?: never; teamId?: never; orgWide: true; role: DashboardAccessRole };
export function useGrantDashboardAccess() {
const queryClient = useQueryClient();
const { orgContext, runReauthableAction } = useOrgDashboard();
const organizationId = orgContext?.organization.id ?? "";View on GitHub (pinned to 2b7df46e8a)
Solutions
- Check the status code: 403 → confirm you have manage access on this dashboard, 401 → re-sign-in, 404 → verify the dashboard still exists, 5xx → inspect server logs
- Reload the page to refresh the Den session and retry the query
- Verify the dashboardId used by the hook matches an existing dashboard
- If 5xx persists, check den-api logs for failures in the access-grant query path
Defensive patterns
Strategy: try-catch
Validate before calling
// only fetch access when the user can manage the dashboard
if (!canManageDashboard(currentUser, dashboardId)) {
return; // skip the access query entirely
} Try / catch
const { error, refetch } = useDashboardAccess(dashboardId);
if (error instanceof Error) {
if (error.message.includes('(403)')) showNoManagePermission();
else showRetryBanner(error.message, refetch);
} Prevention
- Gate the access panel behind a permission check so 403s are expected and handled
- Distinguish 404 (dashboard gone) from 403 (no rights) from 5xx in the error UI
- Retry with backoff only for 5xx and network errors
- Alert on 5xx rates for the access endpoint in production
When it happens
Trigger: Non-2xx from the access endpoint: 401 expired session, 403 caller lacks admin rights on the dashboard, 404 dashboard id invalid, 5xx from den-api while listing grants.
Common situations: Non-admin user opening the access panel; dashboard deleted in another tab; Den session cookie expired mid-session; API deployment in progress returning 502/503 from the gateway.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Failed to load desktop policies (${response.status}).
- Could not load egress diagnostics (${response.status}).
- Egress diagnostic could not start (${response.status}).
- Failed to load inference settings (${response.status}).
- Failed to load dashboards (${response.status}).
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/f86f9ad84a29d3bb.
Report an issue: GitHub.