429 Too Many Requests

The service is rate limiting you: too many requests arrived in a short time, so it refuses more until the limit resets.

Browser console
POST https://api.example.com/generate 429 (Too Many Requests)

Also appears as

  • Failed to load resource: the server responded with a status of 429 (Too Many Requests)
  • AxiosError: Request failed with status code 429

Prompt to fix it

Our app gets "429 Too Many Requests" from an API. First check whether our own code causes the burst: find where the request is sent and look for effects that refire on every render, requests inside loops, large parallel batches, or retries without delay. Fix that cause first. Then add retries with exponential backoff that honor the Retry-After header and stop after a few tries, and cache or batch calls where it makes sense. If the response mentions quota or billing instead of rate, tell me instead of retrying.

Paste into Layerwise or any AI coding tool.

What it means

A 429 is a rate limit. The service counts requests, and for AI APIs also tokens, per minute, hour, or day for each key, user, or IP address, and refuses the excess until the window resets. Many responses include a Retry-After header that says how long to wait.

In AI-built apps, the burst usually comes from your own code. A useEffect that refetches on every render, a request inside a loop, or a retry with no delay can send hundreds of calls in seconds. A column of identical requests in the Network tab is the giveaway.

Some 429s have nothing to do with speed. OpenAI also returns 429 with insufficient_quota when an account is out of credit, and waiting never fixes that. Read the body: a billing or quota message needs a dashboard fix, while a rate message means slow down and retry.

Common causes

  • A useEffect with a missing or ever-changing dependency fires the same request on every render.
  • The code sends one request per item in a loop, or many at once with Promise.all.
  • Failed requests retry immediately, so each failure makes the burst bigger.
  • Many users share one API key or one server IP address, so their combined traffic hits a limit meant for one.
  • The account is on a free or low tier with small limits.

How to fix it

  1. In the Network tab, count how often the request fires. If it repeats on its own, fix the effect or loop that sends it.
  2. Read the response body and headers for the limit, the time window, and Retry-After.
  3. Retry with exponential backoff: wait, double the wait each time, and give up after a few tries.
  4. Cache results, batch items into one request, and debounce calls tied to typing.
  5. If real traffic needs more, raise the limit or upgrade the plan in the provider’s dashboard.

Example fix

export async function fetchWithRetry(url: string, init?: RequestInit, tries = 4) {
  for (let attempt = 0; ; attempt++) {
    const response = await fetch(url, init);
    if (response.status !== 429 || attempt >= tries - 1) return response;

    // Prefer the server's own wait time when it sends one.
    const retryAfter = Number(response.headers.get('Retry-After'));
    const delay = retryAfter > 0 ? retryAfter * 1000 : 2 ** attempt * 500;
    await new Promise((resolve) => setTimeout(resolve, delay));
  }
}
All errors
RateLimitError: 429 You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.

You exceeded your current quota

OpenAI refused the request because the account or project behind the API key is out of credit or has reached a spending limit.

AuthApiError: email rate limit exceeded

Email rate limit exceeded

Supabase stopped sending sign-up, magic link, or reset emails because the project hit its hourly email limit, which is tiny with the built-in sender.

Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

Maximum update depth exceeded

State updates kept triggering more state updates in a loop, usually through an effect or a callback, so React stopped them.

Access to fetch at 'https://api.example.com/items' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Blocked by CORS policy

The browser hid a response from another site because that server never said your site is allowed to read it.

Build with an agent that checks its work

The Layerwise agent clicks through the live preview and reads the console, so it catches errors before you do.