// libSQL error reference

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
類別
Remote server and Hrana errors
錯誤訊息
Server returned HTTP status 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.

如何修正

  1. 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));
      }
    }
  2. 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 });
  3. Check current usage against the plan's limits:

    turso plan show
    turso db inspect mydb
  4. 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.

相關錯誤

More remote server and hrana errors errors

程式碼和訊息文字來自 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. 授權詳情 引用的錯誤訊息文字歸其資料庫廠商所有。