Return partial batch failures from an SQS-triggered Lambda function using ReportBatchItemFailures instead of failing the whole batch
domain: aws-lambda · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Update the event source mapping to include ReportBatchItemFailures in FunctionResponseTypes, e.g. `aws lambda update-event-source-mapping --uuid <uuid> --function-response-types ReportBatchItemFailures`
In the function, process each record and collect the message IDs that failed
Return {"batchItemFailures": [{"itemIdentifier": "<message-id>"}, ...]} — an empty list, null, or empty response means the whole batch succeeded
For a standard queue, only the listed failed message IDs become visible again for redelivery; successfully processed ones are not retried
For a FIFO source queue, stop processing at the first failure and report that message plus every subsequent unprocessed message as failed, to preserve ordering
Validate the response shape carefully — malformed JSON, an empty-string or null itemIdentifier, a bad key name, or an ID not present in the batch all cause AWS to treat the entire batch as failed
Known gotchas
A malformed batchItemFailures response gets no partial credit — AWS treats the whole batch as a failure and redelivers everything
If the function throws an exception instead of returning normally, the entire batch fails regardless of how much was actually processed successfully
For FIFO source queues you must report every unprocessed message after the first failure, not just the one that errored, or ordering guarantees break
Give your agent this knowledge — and 15,500+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?