Skip to content
Back to the playbook

Fixing D1's "too many API requests by single worker invocation" error

Cloudflare D1Cloudflare Workersrevision 1

Diagnostic tree

  1. In progressD1_ERROR: too many API requests by single worker invocationA single Worker invocation that makes many separate calls to D1 fails partway through with this D1-specific error, distinct from D1's CPU-time or memory-limit reset messages.
View the whole map (7 more steps)
  • Count how many separate D1 calls happen in this one invocation
  • Replace the N+1 loop with one query or one batch
  • Check whether other subrequests share the invocation
  • Reduce total subrequests, or raise the configured limit
  • Not a request-count issue — escalate
  • Re-run with representative data volume
  • Resolved

What to test

D1_ERROR: too many API requests by single worker invocation

A single Worker invocation that makes many separate calls to D1 fails partway through with this D1-specific error, distinct from D1's CPU-time or memory-limit reset messages.

What happened?