{"record":{"id":"b336aa49c5bea1db","repo":"different-ai/openwork","slug":"failed-to-load-github-repositories-response-sta","errorCode":null,"errorMessage":"Failed to load GitHub repositories (${response.status}).","messagePattern":"Failed to load GitHub repositories \\((.+?)\\)\\.","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ee/apps/den-web/app/(den)/dashboard/_components/integration-data.tsx","lineNumber":580,"sourceCode":"              id,\n              manifestKind,\n              marketplacePluginCount: typeof entry.marketplacePluginCount === \"number\" ? entry.marketplacePluginCount : null,\n              name: toRepoName(fullName),\n              private: Boolean(entry.private),\n            } satisfies IntegrationRepo];\n          })\n        : [];\n      const repositories: IntegrationRepo[] = [];\n      let cursor: string | null = null;\n      for (let page = 0; page < 30; page += 1) {\n        const { response, payload } = await requestJson(\n          `/v1/connectors/github/accounts/${encodeURIComponent(connectorAccountId ?? \"\")}/repositories?limit=100${cursor ? `&cursor=${encodeURIComponent(cursor)}` : \"\"}`,\n          { method: \"GET\" },\n          20000,\n        );\n\n        if (!response.ok) {\n          throw new Error(getErrorMessage(payload, `Failed to load GitHub repositories (${response.status}).`));\n        }\n\n        repositories.push(...parseRepositories(payload));\n        const nextCursor = isRecord(payload) ? asString(payload.nextCursor) : null;\n        if (!nextCursor) {\n          break;\n        }\n        cursor = nextCursor;\n      }\n      return repositories;\n    },\n  });\n}\n\nexport function useCreateGithubConnectorInstance() {\n  const queryClient = useQueryClient();\n  const { runReauthableAction } = useOrgDashboard();\n","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-web/app/(den)/dashboard/_components/integration-data.tsx#L562-L598","documentation":"useGithubAccountRepositories pages through GET /v1/connectors/github/accounts/{id}/repositories?limit=100 with cursor pagination. On any non-ok response for a page, this error is thrown with the HTTP status embedded; getErrorMessage substitutes a server-provided message when available.","triggerScenarios":"GET repositories returns 401/403 (session expired or GitHub installation revoked), 404 (connectorAccountId empty or account deleted), 429 (GitHub API rate limit relayed by the server), or 5xx while the server proxies GitHub's API.","commonSituations":"User uninstalled the GitHub App from their org so the server can no longer list repos; GitHub API secondary rate limit hit during pagination; connectorAccountId undefined because account data loaded out of order.","solutions":["Check the embedded status: 401/403 → re-authenticate and confirm the GitHub installation still exists; 404 → verify connectorAccountId is set; 429 → wait and retry; 5xx → check server proxy logs.","Reinstall/refresh the GitHub App if the installation was revoked.","Retry later if rate-limited — the query layer refetches automatically on window focus in most setups.","Ensure connectorAccountId is non-empty before invoking the query to avoid a malformed URL."],"exampleFix":"// before\nif (!response.ok) {\n  throw new Error(getErrorMessage(payload, `Failed to load GitHub repositories (${response.status}).`));\n}\n// after\nif (!response.ok) {\n  if (response.status === 429) throw new RetriableError(getErrorMessage(payload, `Failed to load GitHub repositories (${response.status}).`));\n  throw new Error(getErrorMessage(payload, `Failed to load GitHub repositories (${response.status}).`));\n}","handlingStrategy":"retry","validationCode":"if (!connectorAccountId) {\n  // don't call the API with an empty id — it will 404\n  throw new Error(\"No connector account id; cannot load repositories.\");\n}","typeGuard":"function isNonEmptyId(v: string | null | undefined): v is string {\n  return typeof v === \"string\" && v.length > 0;\n}","tryCatchPattern":"try {\n  await repositoriesQuery;\n} catch (e) {\n  const msg = e instanceof Error ? e.message : String(e);\n  if (/\\(429\\)/.test(msg) || /\\(50[0-9]\\)/.test(msg)) {\n    retryWithBackoff(() => repositoriesQuery.refetch(), 3);\n  } else if (/\\(40[134]\\)/.test(msg)) {\n    showReinstallPrompt(); // installation likely revoked or account gone\n  } else {\n    setError(msg);\n  }\n}","preventionTips":["Verify the GitHub installation is still active before listing repositories.","Guard against empty connectorAccountId before building the URL.","Apply backoff on 429/5xx since the server proxies GitHub's rate limits.","Enable TanStack Query retry for transient pagination failures."],"tags":["http","github-api","pagination"],"backgroundTag":"http-request-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}