Cloudflare D1: D1_ERROR: Too many API requests / Statement too long / exceeded storage or row limits

A D1 query hit a platform limit.

Exact message you may see D1_ERROR Too many API requestsD1 statement too longtoo many SQL variables D1D1 limit exceeded
Seen on: Cloudflare D1

Meaning

D1 limits include maximum statement size, bound parameters per query (100), queries per Worker invocation, and database size. Large batch inserts often fail from parameter or size limits.

Common causes

  • More than 100 bound parameters in one statement
  • Very large statement or batch
  • Too many subrequests in one Worker call
  • Database size limit reached

⚡ Quick fix

  1. Chunk inserts into smaller batches with db.batch()
  2. Reduce bound parameters per statement
  3. Archive or split large tables

Detailed fix by platform

Worker

  1. await env.DB.batch(rows.map(r => env.DB.prepare("INSERT INTO t(a,b) VALUES (?,?)").bind(r.a, r.b)))

How to diagnose

  1. Size — Statement/parameter count?
  2. Calls — Per invocation limits?
  3. DB — Total size?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):

10027 — Cloudflare Workers: Error 10027 — Worker exceeded the size limit of 1 MiB / 10 MiB (script too large) (Cloudflare)100271025 — Cloudflare Error 1025: Please check back later (Workers request limit) (Cloudflare)10251102 — Cloudflare Error 1102: Worker exceeded resource limits (CPU time / memory) (Cloudflare)1102413 (Cloudflare 100 MB) — Cloudflare 413 Request Entity Too Large (upload over the plan limit) (Cloudflare)413 (Cloudflare 100 M…D1_ERROR — Cloudflare D1: D1_ERROR: no such table: users: SQLITE_ERROR (Cloudflare)D1_ERRORENHANCE_YOUR_CALM — HTTP/2 ENHANCE_YOUR_CALM (too many streams / rapid reset) (HTTP)ENHANCE_YOUR_CALMHTTP/2 header list — HTTP/2 header list size exceeded (431 / COMPRESSION_ERROR) (HTTP)HTTP/2 header listSAN limit — Certificate request failed: too many domain names in one certificate (SAN limit exceeded) (SSL / TLS)SAN limitD1 limits

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.