api rate_limiting ai_generated partial

HTTP 403: You have exceeded a secondary rate limit. Please wait a few minutes before you try again.

ID: api/github-secondary-rate-limit

Also available as: JSON · Markdown
72%Fix Rate
85%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

GitHub has undocumented 'secondary' rate limits separate from the 5000 req/hr primary limit. Triggered by concurrent requests, rapid content creation, or polling. Not visible in X-RateLimit headers.

generic

Workarounds

  1. 90% success Add 1s sleep between mutating requests (POST/PATCH/PUT)
    import time; time.sleep(1)  # between each write API call
  2. 88% success Use conditional requests with ETags for polling endpoints
    headers = {'If-None-Match': cached_etag}  # 304 responses don't count against limits
  3. 85% success Implement exponential backoff starting at 60s on 403, with jitter
    wait = 60 * (2 ** retry_count) + random.uniform(0, 10)

Dead Ends

Common approaches that don't work:

  1. Check X-RateLimit-Remaining header and stay under 5000/hr 88% fail

    Secondary rate limits are separate and invisible in standard rate limit headers. You can hit them at 100 req/hr if requests are concurrent.

  2. Use a personal access token instead of GitHub App token 80% fail

    Secondary rate limits apply to all authentication methods equally. PATs are not exempt.

  3. Retry immediately after 403 75% fail

    GitHub may escalate to longer bans if you retry too aggressively after secondary rate limit.