Cloudflare D1: D1_ERROR: Too many API requests / Statement too long / exceeded storage or row limits
A D1 query hit a platform limit.
D1_ERROR Too many API requestsD1 statement too longtoo many SQL variables D1D1 limit exceeded 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
- Chunk inserts into smaller batches with
db.batch() - Reduce bound parameters per statement
- Archive or split large tables
Detailed fix by platform
Worker
await env.DB.batch(rows.map(r => env.DB.prepare("INSERT INTO t(a,b) VALUES (?,?)").bind(r.a, r.b)))
How to diagnose
- Size — Statement/parameter count?
- Calls — Per invocation limits?
- 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:
Similar errors
Most viewed in Cloudflare
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 2 Dec 2026