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 || ''}` ); }