{"record":{"id":"de64f09a1eae4157","repo":"Egonex-AI/Understand-Anything","slug":"freshness-request-failed","errorCode":null,"errorMessage":"Freshness request failed","messagePattern":"Freshness request failed","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"understand-anything-plugin/packages/dashboard/src/freshness.ts","lineNumber":173,"sourceCode":"    !(\"domain\" in value.graphs) ||\n    isGraphFreshnessResult(value.graphs.domain)\n  );\n}\n\nexport function shouldRequestFreshness(\n  demoMode: boolean,\n  demoFreshnessUrl?: string,\n): boolean {\n  return !demoMode || Boolean(demoFreshnessUrl);\n}\n\nexport async function requestFreshnessReport(\n  url: string,\n  signal: AbortSignal,\n  fetcher: typeof fetch = fetch,\n): Promise<DashboardFreshnessReport> {\n  const response = await fetcher(url, { signal, cache: \"no-store\" });\n  if (!response.ok) throw new Error(\"Freshness request failed\");\n\n  const payload: unknown = await response.json();\n  if (!isDashboardFreshnessReport(payload)) {\n    throw new Error(\"Freshness response was malformed\");\n  }\n  return payload;\n}\n\ninterface FreshnessRefreshOptions {\n  target: Pick<EventTarget, \"addEventListener\" | \"removeEventListener\">;\n  load: (signal: AbortSignal) => Promise<DashboardFreshnessReport>;\n  onResult: (report: DashboardFreshnessReport) => void;\n}\n\nfunction requestFailedReport(): DashboardFreshnessReport {\n  return {\n    graphs: {\n      knowledge: {","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/32944829e7a63a9fa9c55d811d7f98a9530c6a6a/understand-anything-plugin/packages/dashboard/src/freshness.ts#L155-L191","documentation":"Thrown by requestFreshnessReport when the HTTP response from the freshness endpoint has a non-ok status. The function fetches the URL with an AbortSignal and no-store cache, then immediately checks response.ok before parsing the body; any 4xx/5xx is fatal and not retried. Callers in startFreshnessRefresh catch it and degrade to an 'unknown/freshness-request-failed' report.","triggerScenarios":"The dashboard dev server's freshness endpoint returns 404 (route removed/misconfigured), 401/403 (access token invalid), 500 (server-side git probe failure), or the endpoint is unreachable and a non-ok response is returned by a proxy.","commonSituations":"Dashboard dev server running a version that lacks the freshness route; access token expired or revoked; reverse proxy returning an error page; the freshness endpoint disabled in a deployment.","solutions":["Verify the dashboard dev server is running and the freshness URL is correct and reachable.","Check the access token used for the freshness endpoint is valid and has not expired.","Inspect server logs for the underlying status code returned by the freshness route.","Handle the error gracefully — startFreshnessRefresh already maps it to an 'unknown' report, so ensure callers rely on that fallback rather than treating it as fatal."],"exampleFix":"// before\nconst report = await requestFreshnessReport(url, signal);\n// after — tolerate failure and use the degraded report\ntry { const report = await requestFreshnessReport(url, signal); }\ncatch { /* fall back to { graphs: { knowledge: { status: 'unknown', reason: 'freshness-request-failed' } } } */ }","handlingStrategy":"fallback","validationCode":"// pre-check the endpoint reachability before the freshness call\nconst probe = await fetch(url, { method: 'HEAD' });\nif (!probe.ok) { /* skip freshness, use degraded report */ }","typeGuard":null,"tryCatchPattern":"try { const report = await requestFreshnessReport(url, signal); onResult(report); }\ncatch (e) { onResult({ graphs: { knowledge: { status: 'unknown', reason: 'freshness-request-failed' } } }); }","preventionTips":["Rely on startFreshnessRefresh which already degrades to an 'unknown' report on failure.","Keep the dashboard dev server version aligned with the client so the freshness route exists.","Validate the access token used by the freshness endpoint."],"tags":["dashboard","network","http","freshness"],"backgroundTag":null,"analyzedSha":"32944829e7a63a9fa9c55d811d7f98a9530c6a6a","analyzedAt":"2026-08-12T10:25:44.261Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}