fix: Handle HTTP 429 status code for rate limiting by abtris · Pull Request #3951 · google/go-github

@abtris

GitHub API can return either 403 or 429 for rate limiting, but the
library was only checking for 403. This caused 429 responses to be
treated as generic ErrorResponse instead of RateLimitError or
AbuseRateLimitError, breaking retry logic and rate limit handling.

Changes:
- CheckResponse now detects 429 with X-RateLimit-Remaining: 0 as
  RateLimitError (primary rate limit)
- CheckResponse now detects 429 with secondary rate limit
  documentation_url as AbuseRateLimitError

Reference: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api

@abtris changed the title Handle HTTP 429 status code for rate limiting fix: handle HTTP 429 status code for rate limiting

Jan 30, 2026

@abtris abtris changed the title fix: handle HTTP 429 status code for rate limiting fix: Handle HTTP 429 status code for rate limiting

Jan 30, 2026

Not-Dhananjay-Mishra