{"record":{"id":"0399df2e2b169547","repo":"supabase/supabase","slug":"failed-to-fetch-incident-status-response-status","errorCode":null,"errorMessage":"Failed to fetch incident status: ${response.statusText}","messagePattern":"Failed to fetch incident status: (.+?)","errorType":"http","errorClass":"ResponseError","httpStatus":null,"severity":"error","filePath":"apps/studio/data/platform/incident-status-query.ts","lineNumber":32,"sourceCode":"    method: 'GET',\n    credentials: 'omit',\n    headers: {\n      'Content-Type': 'application/json',\n    },\n  })\n\n  if (!response.ok) {\n    const errorText = await response.text()\n    console.error('[getIncidentStatus] Failed:', response.status, errorText)\n\n    let retryAfter: number | undefined\n    const retryAfterHeader = response.headers.get('Retry-After')\n    if (retryAfterHeader !== null) {\n      const parsed = Number(retryAfterHeader)\n      if (Number.isFinite(parsed) && parsed > 0) retryAfter = parsed\n    }\n\n    throw new ResponseError(\n      `Failed to fetch incident status: ${response.statusText}`,\n      response.status,\n      undefined,\n      retryAfter\n    )\n  }\n\n  const data = await response.json()\n  const [maintenanceEvents, incidents] = partition(\n    data ?? [],\n    (event) => event.impact === 'maintenance'\n  )\n  return { maintenanceEvents, incidents }\n}\n\nexport type IncidentStatusData = Awaited<ReturnType<typeof getIncidentStatus>>\nexport type IncidentStatusError = unknown\n","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/supabase/supabase/blob/beee91b9c2228dd57302dec75c733baaa84ab543/apps/studio/data/platform/incident-status-query.ts#L14-L50","documentation":"Thrown by getIncidentStatus as a ResponseError when the fetch to the incident-status endpoint returns non-2xx. Unlike the banner error, this carries structured data: response.status and an optional retryAfter parsed from the Retry-After response header (only when it is a finite positive number). The function also logs the status and body text to console.error before throwing.","triggerScenarios":"The incident-status endpoint returns 4xx/5xx. A 429 typically carries a Retry-After header that the function captures and exposes on the error; a 5xx indicates the upstream status provider or Studio API is failing.","commonSituations":"Status provider rate-limited (429 + Retry-After); upstream status feed down; Studio API route misconfigured; auth/permission issues surfacing as 401/403.","solutions":["Inspect err.status and honor err.retryAfter before retrying the query.","Surface a degraded status state in the UI rather than crashing.","Check the upstream status provider and Studio API health.","For 429s, configure the query's retryDelay to respect the Retry-After value."],"exampleFix":"// before: generic catch\ntry { await getIncidentStatus() } catch (e) { /* ? */ }\n// after: structured handling\ntry {\n  const status = await getIncidentStatus()\n} catch (e) {\n  if (e instanceof ResponseError && e.status === 429 && e.retryAfter) {\n    scheduleRetryIn(e.retryAfter)\n  } else {\n    showDegradedStatus()\n  }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const isIncidentStatusResponseError = (e: unknown): e is ResponseError =>\n  e instanceof ResponseError && /Failed to fetch incident status/.test(e.message)\n\n// 429 with Retry-After\nconst isRateLimited = (e: ResponseError): boolean =>\n  e.status === 429 && typeof e.retryAfter === 'number' && e.retryAfter > 0","tryCatchPattern":"try {\n  const status = await getIncidentStatus(signal)\n  // render status\n} catch (e) {\n  if (e instanceof ResponseError) {\n    if (e.status === 429 && typeof e.retryAfter === 'number') {\n      // honor Retry-After before next query attempt\n      await delay(e.retryAfter * 1000)\n    } else if (e.status >= 500) {\n      showDegradedStatus()\n    } else {\n      // 4xx other than 429: surface to UI\n      showStatusError(e)\n    }\n    return\n  }\n  throw e\n}","preventionTips":["Honor err.retryAfter (seconds) before retrying on 429 responses.","Surface a degraded status state in the UI for 5xx instead of crashing.","Check the upstream status provider and Studio API health when errors persist.","The function already console.errors status + body text; inspect server logs for diagnosis."],"tags":["network","fetch","incident-status","http","rate-limit","response-error"],"backgroundTag":null,"analyzedSha":"beee91b9c2228dd57302dec75c733baaa84ab543","analyzedAt":"2026-08-12T06:51:48.935Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}