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 callBatchWriteItem 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
BatchWriteItemwithout 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
- Chunk into groups of ≤25 actions and send one
BatchWriteItemper chunk. - Handle
UnprocessedItems—BatchWriteItemcan return items it didn't process (throttling); retry those with exponential backoff. This is normal even within a valid 25-item batch. - Keep each batch under 16 MB — with large items you may need fewer than 25 per call.
- Use a helper/mapper that chunks and retries for you (the SDK document-client batch writers do this) rather than hand-rolling the loop.
Related errors
- Too many items requested for the BatchGetItem call — the read-side limit (100 items).
- Provided list of item keys contains duplicates — the same key twice in one BatchWriteItem.
- ProvisionedThroughputExceededException — throttling that surfaces as UnprocessedItems.