networking http ai_generated true

HTTP/1.1 429 Too Many Requests

ID: networking/http-429-rate-limited

Also available as: JSON · Markdown
90%Fix Rate
92%Confidence
70Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

The server is rate-limiting the client due to too many requests in a given time window. The response typically includes a Retry-After header indicating when the client can retry. Common with API services, CDNs, and reverse proxies with rate limiting enabled.

generic

Workarounds

  1. 92% success Implement exponential backoff with Retry-After header respect
    1. Parse the Retry-After header from the 429 response
    2. If Retry-After is present, wait that many seconds before retrying
    3. If absent, use exponential backoff: wait 1s, 2s, 4s, 8s, etc.
    4. Add jitter to avoid thundering herd: delay + random(0, delay * 0.1)
    5. Set a maximum retry count (e.g., 5 attempts) to avoid infinite loops
    6. Log rate limit events to monitor and adjust client behavior
  2. 90% success Implement client-side rate limiting to stay within the API's limits proactively
    1. Check the API documentation for rate limit quotas (e.g., 100 req/min)
    2. Implement a token bucket or sliding window rate limiter in the client
    3. Queue requests and dispatch them at a rate below the limit
    4. Use bulk/batch API endpoints where available to reduce request count
    5. Cache responses to avoid repeated identical requests
    6. Monitor X-RateLimit-Remaining headers to track quota usage in real time

Dead Ends

Common approaches that don't work:

  1. Immediately retry the request without respecting the Retry-After header 90% fail

    Ignoring the Retry-After header and retrying immediately increases the request rate, extending the rate limit window or escalating to a longer ban. Many APIs implement progressive penalties for clients that ignore rate limits.

  2. Rotate API keys or IP addresses to circumvent rate limits 75% fail

    Most APIs explicitly prohibit rate limit circumvention in their terms of service. This can result in permanent bans, account termination, and legal consequences. It also does not scale sustainably.

Error Chain

Leads to:
Preceded by:
Frequently confused with: