yamadashy/repomix · error · RepomixError
GitHub API error: ${response.status} ${response.statusText}
Error message
GitHub API error: ${response.status} ${response.statusText} What it means
Fallback branch of checkGitHubResponse: any response that is not ok and did not match the earlier 404/403/5xx checks is reported with its raw HTTP status and statusText. It signals an unexpected API condition the library has no specific message for.
Source
Thrown at src/core/git/gitHubArchiveApi.ts:66
const rateLimitRemaining = response.headers.get('X-RateLimit-Remaining');
if (rateLimitRemaining === '0') {
const resetTime = response.headers.get('X-RateLimit-Reset');
const resetDate = resetTime ? new Date(Number.parseInt(resetTime, 10) * 1000) : null;
throw new RepomixError(
`GitHub API rate limit exceeded. ${resetDate ? `Rate limit resets at ${resetDate.toISOString()}` : 'Please try again later.'}`,
);
}
throw new RepomixError(
'Access denied. The repository might be private or you might not have permission to access it.',
);
}
if (response.status === 500 || response.status === 502 || response.status === 503 || response.status === 504) {
throw new RepomixError('GitHub server error. Please try again later.');
}
if (!response.ok) {
throw new RepomixError(`GitHub API error: ${response.status} ${response.statusText}`);
}
};
View on GitHub (pinned to f465ad9093)
Solutions
- Read the status code in the message and look it up in GitHub's REST API docs to identify the cause.
- If status is 401, replace the invalid/expired GITHUB_TOKEN with a fresh one.
- If status is 429, slow down request volume or add a token (a proxy may be rate limiting, not GitHub).
- Update repomix to the latest version in case the GitHub API behavior changed and the library handles it.
Example fix
// before (malformed token => 401) export GITHUB_TOKEN=" " // after export GITHUB_TOKEN=ghp_freshValidToken
Defensive patterns
Strategy: try-catch
Type guard
const isGitHubApiError = (e: unknown): e is RepomixError =>
e instanceof RepomixError && /^GitHub API error: \d{3}/.test(e.message); Try / catch
try {
await pack({ remote: url });
} catch (e) {
const m = e instanceof RepomixError ? e.message.match(/GitHub API error: (\d+)/) : null;
if (m) {
console.error(`Unexpected GitHub status ${m[1]}; consult GitHub REST API docs for this code.`);
} else throw e;
} Prevention
- Keep repomix updated so new GitHub API statuses/behaviors are handled explicitly.
- Log the full status and statusText (they are in the message) before deciding on recovery.
- Verify token format/validity to rule out 401s, the most common unexpected status.
When it happens
Trigger: The GitHub API/archive endpoint returns any non-2xx status other than 404, 403, and 500/502/503/504 — e.g. 401 (bad token), 422, or an unusual 3xx/4xxsurfacing from proxies or API changes.
Common situations: Malformed GITHUB_TOKEN causing 401; API surface changes or deprecations; proxies/gateways injecting their own status codes (e.g. 429 from a corporate rate limiter); GitHub preview/API version mismatches.
Related errors
- GitHub API rate limit exceeded. ${resetDate ? `Rate limit re
- Failed to download GitHub archive after ${retries} attempts.
- No response body received
- Repository not found or is private. Please check the reposit
- Access denied. The repository might be private or you might
AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29).
Data as JSON: /api/errors/68a9733f9f2a1f45.
Report an issue: GitHub.