Too many items requested for the BatchWriteItem call

TL;DR — BatchWriteItem accepts at most 25 put/delete actions per call (and ≤16 MB total). You sent more than 25, so DynamoDB rejected the whole request. Split your items into chunks of 25 or fewer and issue one BatchWriteItem per chunk.

What it means

ValidationException: Too many items requested for the BatchWriteItem call

BatchWriteItem batches individual PutRequest/DeleteRequest actions across one or more tables — but a single call is hard-capped at 25 actions and 16 MB of data. Cross either limit and DynamoDB rejects the entire request before writing anything. It's an HTTP 400 ValidationException, client-side, and not retryable until you resize the batch.

Why it happens

  • Writing a large collection in one call — passing an array of hundreds of items straight into BatchWriteItem without chunking.
  • A chunk loop with the wrong bound — batching by count but using a limit above 25, or an off-by-one that lets 26 through.
  • Counting tables, not actions — the 25 limit is total actions across all tables in the request, not per table.
  • Oversized payload — even at ≤25 items, exceeding 16 MB combined trips a related limit.

How to fix it

  1. Chunk into groups of ≤25 actions and send one BatchWriteItem per chunk.
  2. Handle UnprocessedItemsBatchWriteItem can return items it didn't process (throttling); retry those with exponential backoff. This is normal even within a valid 25-item batch.
  3. Keep each batch under 16 MB — with large items you may need fewer than 25 per call.
  4. Use a helper/mapper that chunks and retries for you (the SDK document-client batch writers do this) rather than hand-rolling the loop.

Bekerja dengan DynamoDB tanpa Console

DynoTable adalah klien desktop yang cepat untuk DynamoDB — jelajahi tabel, jalankan query gaya SQL, dan edit Item secara lokal.