Too many requests (429) errors explained
A 429 is a polite no: the service is fine, your app asked too often. Usually one runaway loop is to blame, not real traffic.

Key takeaways
- A 429 means the receiving service is rate limiting you; the fix is fewer or slower requests, not a bigger server.
- The top cause in AI-built apps is a request inside a render loop or effect that fires on every update.
- Retry with exponential backoff and respect the Retry-After header; never retry instantly in a loop.
- Debounce search boxes, cache repeated reads, and batch writes before asking for a higher limit.
HTTP status 429 Too Many Requests means the service you called is rate limiting your app: it accepted only so many requests in a time window and refused the rest. The most likely cause is not popularity but a bug that sends the same request over and over, such as a fetch inside a React effect that re-runs on every render, a search box that calls an API on every keystroke, or an automatic retry with no delay. Find the burst first. Raising a limit before you do just moves the wall.
What the error actually tells you
A 429 is different from a 500. A 500 says the server broke; a 429 says the server is healthy and chose to say no. Limits are usually counted per key, per user, per IP address or per project, over a window such as a second, a minute or a day. Many services include a Retry-After header saying how many seconds to wait, and some add headers showing the remaining quota. The rate limiting glossary entry covers the window types if you want the theory.
Start by answering one question: who sent the 429? Your own backend, your backend's auth or database layer, or a third-party API such as a payment, email, maps or AI provider. The fix differs for each, and the error body almost always names the service.
Causes, most likely first
1. A request inside a loop that should run once
In React apps, a fetch inside useEffect with a missing or unstable dependency (an object or function recreated on every render) runs again on each render. If the response updates state, that state change causes another render, and the app hammers the API dozens of times a second until it is blocked. In games, the same thing happens when a score save or leaderboard call sits inside the frame loop and fires 60 times a second.
Check: open the browser's Network tab on the published site and sort by name. If the same URL appears hundreds of times within seconds of page load with nobody touching anything, this is your cause. Fix: make the request run once per real change: correct dependencies, a guard flag, or moving the call to an event handler (a button press, the end of a level).
2. Instant retries that turn one failure into hundreds
A request fails, the code retries immediately, it fails again, and the retries themselves trip the limit. Fix: exponential backoff with jitter. A good starting rule: wait 1 second, then 2, then 4, then 8, add a random 0 to 500 milliseconds to each wait so many clients do not retry in lockstep, and stop after 4 or 5 attempts with a clear message. If the response has Retry-After, wait at least that long.
3. Calls on every keystroke or scroll
Autocomplete that queries on every letter makes 12 requests for "coffee shops". Infinite scroll that fires a load on every scroll event can make dozens per swipe. Fix: debounce typing (wait about 250 to 400 milliseconds after the last key), require two or three characters before searching, and trigger scroll loads only when a sentinel near the bottom comes into view, with one load in flight at a time.
4. Repeated reads of data that barely changes
Every page load asks for the same list of categories, the same exchange rate, the same weather. Fix: cache. Keep the response in memory or local storage with a sensible lifetime (an exchange rate can be 10 minutes old, a product catalog an hour), or cache it on the server so a thousand visitors cause one upstream call. The caching explainer lists where caches can live.
5. Many small writes instead of one batch
Importing 500 rows with 500 separate insert calls, or saving a form field by field, burns through limits fast. Fix: batch: one insert with many rows, or one save when the user is done.
6. The limit is genuinely too low for real traffic
If the Network tab shows normal behavior (one request per user action) and 429s appear only at busy times, you have real demand. Some providers raise limits on paid tiers. Spread work over time with a queue or a scheduled job rather than doing it all at once.
7. Bots or a scraper hitting a public endpoint
If the 429s come from a provider your edge function calls, and the logs show bursts from a handful of IP addresses at odd hours, someone may be calling your public function directly. Every call spends your shared quota. Fix: require sign-in for functions that do not need to be public, add your own per-user or per-IP limit in the function (for example 20 requests a minute) that answers 429 before it reaches the provider, and validate input so junk requests stop early.
Limits you may hit in a Startbase app
- AI calls through the App AI gateway: the docs note that project and organization rate limits apply to gateway requests (AI docs). A chat feature that resends the whole conversation on every keystroke, or a page that generates an image on each render, hits these quickly. Also set a runtime cap for each app in Settings, under Usage, so a loop costs you a capped amount.
- Third-party keys in edge functions: a function that calls a provider with your key shares that provider's limit across every visitor. One visitor's loop can block everyone.
- Your backend logs: Backend, Logs searches API, Auth and Functions events. Filter the time window around the errors and look for one route or function repeating (logs docs).
The message to send the agent
Give it the failing URL or service and ask for a count before a fix, so it proves the loop exists:
Users get "429 Too Many Requests" from the search endpoint, usually right after the results page opens. Find every place this page calls search or any other API, and tell me how many requests fire on page load and per keystroke. Make each call run only on a real change, debounce the search box by 300 ms with a 2 character minimum, cache the category list for 10 minutes, and add retries with exponential backoff (1, 2, 4, 8 seconds plus jitter, max 4 tries) that respect Retry-After. Show a friendly "Busy, retrying" message instead of an error.
For a game, swap the specifics: "the leaderboard save fires every frame; save once when the run ends and at most once every 5 seconds during play."
How to confirm it is fixed
- 01Open the Network tab, reload the page and touch nothing for 30 seconds. Repeating requests should be zero or match a polling interval you chose.
- 02Type a ten letter search: you should see one or two requests, not ten.
- 03Force a failure (turn off Wi-Fi briefly) and watch retries space out instead of firing in a burst.
- 04Check Backend, Logs an hour after publishing for any new 429 lines.
Frequently asked questions
Is a 429 error my fault or the server's?
Usually the client's. The server is working and refusing extra requests. Most 429s in new apps come from a request that repeats in a loop, a retry without delay, or calls on every keystroke.
How long should I wait after a 429?
If the response includes a Retry-After header, wait at least that many seconds. If not, back off exponentially: about 1, 2, 4 and 8 seconds with a little random jitter, then give up and show a message.
Will upgrading my hosting fix 429 errors?
Rarely. The limit belongs to the service you call, not to your hosting. Fix the request pattern first; only if real traffic exceeds the limit should you look at a higher provider tier.
Can a single user trigger a 429 for everyone?
Yes, when the limit is counted per API key and every visitor shares your key through an edge function. That is another reason to debounce, cache, and cap retries.

