yamadashy/repomix · error · RepomixError

GitHub API rate limit exceeded. ${resetDate ? `Rate limit re

Error message

GitHub API rate limit exceeded. ${resetDate ? `Rate limit resets at ${resetDate.toISOString()}` : 'Please try again later.'}

What it means

When GitHub replies 403 with the X-RateLimit-Remaining header at 0, the unauthenticated API rate limit (60 requests/hour per IP) has been exhausted. The error includes the exact reset time from X-RateLimit-Reset when the header is present.

Source

Thrown at src/core/git/gitHubArchiveApi.ts:52

  return null;
};

/**
 * Checks if a response indicates a GitHub API rate limit or error
 */
export const checkGitHubResponse = (response: Response): void => {
  if (response.status === 404) {
    throw new RepomixError(
      'Repository not found or is private. Please check the repository URL and your access permissions.',
    );
  }

  if (response.status === 403) {
    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

  1. Set a GitHub token to raise the limit to 5,000/hour: `export GITHUB_TOKEN=ghp_...` and re-run.
  2. Wait until the reset time printed in the error message, then retry.
  3. Cache repacked output and avoid re-packing unchanged repos in loops/CI to reduce request volume.

Example fix

// before
npx repomix --remote https://github.com/user/repo   // 403 rate limit (60/hr)
// after
export GITHUB_TOKEN=ghp_yourToken
npx repomix --remote https://github.com/user/repo   // 5000/hr
Defensive patterns

Strategy: retry

Validate before calling

const remaining = await fetch('https://api.github.com/rate_limit', {
  headers: process.env.GITHUB_TOKEN ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } : {}
}).then(r => r.json());
if (remaining.resources.core.remaining === 0) {
  throw new Error('GitHub rate limit exhausted; wait until ' + new Date(remaining.resources.core.reset * 1000).toISOString());
}

Try / catch

try {
  await pack({ remote: url });
} catch (e) {
  if (e instanceof RepomixError && e.message.includes('rate limit exceeded')) {
    const reset = e.message.match(/resets at (.+?)'/)?.[1];
    console.error(`Rate limited; retry after ${reset ?? 'the reset window'}`);
  } else throw e;
}

Prevention

When it happens

Trigger: A GitHub API request returns HTTP 403 and header X-RateLimit-Remaining: 0 — too many remote-packing requests from one IP/token within the rate-limit window.

Common situations: CI runners sharing one egress IP hitting the 60/hour anonymous limit; scripts looping over many repos without a token; a shared office/NAT IP already exhausted by other users.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/a31915438caeb419. Report an issue: GitHub.