429 Too Many Requests: request rate limit hit
Turso throttles request rate with 429: back off and retry and it clears, while billing quota exhaustion surfaces as the BLOCKED error code instead.
- エラー
429 Too Many Requests
意味
Turso throttles bursts of requests with 429. It is a short-term signal: back off and retry, and it clears. Quota exhaustion is different: the docs say exceeding the monthly row-read, row-write, or storage quota fails with the BLOCKED error code, and Turso's response-code reference does not list 429 at all. So a 429 points at request rate, not at billing.
よくある原因
- More concurrent requests than the plan allows, often from a connection pool sized for a different database.
- A retry loop with no backoff turning one slow request into a storm.
- Monthly quota exhaustion, but that surfaces as
BLOCKED, not 429, so check usage before assuming quota. - A batch job and live traffic sharing one database with no limit on either side.
Find the cause
Check `turso plan show` and `turso db inspect mydb` first: quotas that are exhausted show up as `BLOCKED` rather than 429, so a real 429 is about request rate. Look at how many concurrent clients and retries hit the database in the seconds before the error, and count how many connections your pool opens. A retry loop that fires on every failure with no delay is the classic cause.
修正方法
-
Retry the request with exponential backoff and honor any Retry-After header:
// retry on 429 with backoff for (let i = 0; i < 5; i++) { try { return await db.execute(sql); } catch (e) { if (!String(e).includes('429') || i === 4) throw e; await new Promise(r => setTimeout(r, 500 * 2 ** i)); } } -
Cap the connection pool so live traffic cannot starve the limit:
// @libsql/client: reuse one client, do not create one per request const db = createClient({ url: process.env.LIBSQL_URL, authToken: process.env.LIBSQL_TOKEN }); -
Check current usage against the plan's limits:
turso plan show turso db inspect mydb
-
Collapse many small statements into one batch to cut request count:
await db.batch([ { sql: "INSERT INTO t (a) VALUES (?)", args: [1] }, { sql: "INSERT INTO t (a) VALUES (?)", args: [2] } ]);
Other ways to handle it
Move read-heavy work to an embedded replica, which reads a local file and sends no requests. Move bursty writes into batches. If you are permanently above the quota, change plan instead of masking 429s with retries. If usage itself is the problem, the error will be BLOCKED, and no retry pattern helps until the quota resets or the plan changes.
安全に再現する
Reproducing 429 honestly needs a real database and enough traffic to trip the limit, which I would not run against a production database. The shape is easy to demonstrate though: fire a few hundred parallel requests from a loop at one test database with @libsql/client until the server answers 429. Local `turso dev` has no rate limiter, so it cannot reproduce it.
質問
Why do I get BLOCKED instead of 429 on Turso?
Quota exhaustion (monthly row reads, row writes, or storage) fails with the BLOCKED error code per Turso's usage docs. 429 is the burst request-rate signal. Check turso plan show to see which one you hit.
How do I check my current Turso usage and limits?
turso plan show prints the current plan usage and limits, and turso db inspect <db> shows a database's rows read, rows written, and space used. turso org billing opens the billing portal.
Does retrying fix a 429 from Turso?
Only when it is request rate: back off exponentially, honor Retry-After if present, and cap concurrent clients. If the real problem is an exhausted quota the error is BLOCKED, and retries change nothing until the reset or an upgrade.
関連エラー
too many connectionsToo many connections to one databaseSQLITE_BUSYSQLITE_BUSY: the database is busy401 Unauthorized401 Unauthorized: bad or missing auth token
More remote server and hrana errors errors
404 Not Found404 Not Found: unknown database or endpointconnection reset / interruptedConnection reset or droppedTransaction timed-outinteractive transaction abortedError in remote responseError in remote response500 Internal Server Errorserver failed on a valid request402 Payment Required402 Payment Required409 Conflict409 Conflictdatabase not foundturso CLI: database not found
コードとメッセージのテキストは、 libSQL / Turso documentation。全容は次で参照 libSQL error list または すべてのデータベースエラーを検索.
Work on libSQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for libSQL and the other databases you use.
このページのテキストとデータ: CC BY 4.0、出典は SQLly (sqlly.app) と明記してください。 コードと SQL スニペット: MIT. ライセンスの詳細 引用したエラーメッセージの文言は、各データベースベンダーに帰属します。