From bc95c433686f899af16e850cea0a1c74aa200017 Mon Sep 17 00:00:00 2001 From: Mohd Subhan Date: Wed, 3 Jun 2026 10:44:14 +0530 Subject: [PATCH] fix(github): preserve GraphQL response body after retry exhaustion --- lib/github.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/github.ts b/lib/github.ts index 969a3ca2f..ec2fcee6c 100644 --- a/lib/github.ts +++ b/lib/github.ts @@ -524,9 +524,15 @@ async function fetchContributionsUncached( if (!res.ok) { throwIfRateLimited(res); - if (res.status === 401) throw new Error('GitHub PAT is invalid or missing'); + + const bodyText = await res.text().catch(() => ''); + + if (res.status === 401) { + throw new Error(`GitHub PAT is invalid or missing. Response: ${bodyText || ''}`); + } + throw new Error( - `GitHub GraphQL API returned status ${res.status} after ${MAX_RETRIES} retries` + `GitHub GraphQL API returned status ${res.status} after ${MAX_RETRIES} retries. Response: ${bodyText || ''}` ); }