---
title: "Set aside messages that keep failing · Agent Wranglers"
url: https://agentwranglers.se/playbook/events/background-jobs-and-queues/dead-letter-queue
id: EVT-23
level: Recommended
updated: 2026-10-27
build: a2a6bdfed830
tokens: 799
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Set aside messages that keep failing

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Background jobs and queues](https://agentwranglers.se/playbook/events/background-jobs-and-queues.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: EVT-23
- Level: Recommended
- Chapter: [Background jobs and queues](https://agentwranglers.se/playbook/events/background-jobs-and-queues.md)
- Rule: After a set number of failed attempts, move a message or job to a separate dead letter queue and alert. Never retry it forever or drop it.
- Check: Send a message that always fails. After the limit it sits in the dead letter queue with its error, an alert has fired, and other messages still flow.
- How: Count attempts on each message, and back off between them, such as 5 attempts over an hour. After the limit, store the message with its last error, so a person can fix the cause and replay it. Most queues have this built in, such as a redrive policy or a failed jobs table.

## Sources

- [Amazon SQS dead-letter queues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html)

## Related rules

- API-34 [Retry with backoff and jitter](https://agentwranglers.se/playbook/api-design/reliability/retry-backoff.md) in API design
- API-78 [Decide what happens when a provider is down](https://agentwranglers.se/playbook/api-design/using-other-companies-apis/provider-outages.md) in API design
- OPS-67 [Alert on the age of the oldest waiting job](https://agentwranglers.se/playbook/operations/alerts-and-on-call/queue-age.md) in Operations and observability
- STK-35 [Use BullMQ or RQ for background jobs](https://agentwranglers.se/playbook/stack/databases-and-storage/background-jobs.md) in Software choices
- DEN-39 [Commit stream offsets in the same transaction as the data](https://agentwranglers.se/playbook/data-engineering/loading-and-change-data-capture/exactly-once-sinks.md) in Data engineering
- EVT-17 [Give every job a time limit](https://agentwranglers.se/playbook/events/background-jobs-and-queues/job-time-limits.md) in Integration and events
- ANA-2 [Validate every event before you store it](https://agentwranglers.se/playbook/analytics/events-and-metrics/event-validation.md) in Product analytics and experiments

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/events/background-jobs-and-queues/dead-letter-queue">Agent Wranglers integration and events playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Run each scheduled job once at a time](https://agentwranglers.se/playbook/events/background-jobs-and-queues/single-job-runs.md)
- Next: [Replay dead letters with a written procedure](https://agentwranglers.se/playbook/events/background-jobs-and-queues/dead-letter-replay.md)
- [Background jobs and queues](https://agentwranglers.se/playbook/events/background-jobs-and-queues.md)
