Skip to content
Get started
Get started
Dead Letter Queue: What Happens to Failed Jobs
guide · dead letter queue

Failed jobs, kept in the DLQ.

When a job runs out of retries, bunqueue can retain it in the Dead Letter Queue with the terminal error and attempt metadata, so you can inspect it and retry it deliberately.

The Dead Letter Queue (DLQ) is a holding area for jobs that failed permanently, for example after exhausting all retry attempts. Unless removeOnFail is set, each entry keeps the original job, its terminal error, and a complete ordered array of AttemptRecord values. The history includes retryable failures before the terminal attempt and remains attached across automatic DLQ redeliveries.

Entries are not permanent by definition: maxAge, maxEntries, an explicit purge, or Queue.obliterate() can remove them. The defaults retain entries for seven days and cap each queue at 10,000 entries. Capacity eviction removes the oldest entry from memory and SQLite together, including its terminal ownership and stored result/log data.

import { Queue } from 'bunqueue/client';
const queue = new Queue('emails', { embedded: true });
// See what failed and why
const entries = queue.getDlq();
for (const entry of entries) {
console.log(entry.job.id, entry.reason, entry.error);
}
// Put everything back in the queue for another try
queue.retryDlq();

From the CLI, against a running server:

Terminal window
bunqueue dlq list emails
bunqueue dlq retry emails
bunqueue dlq purge emails
DLQ Operations from the Queue ObjectThe same operations from an existing Queue instance
DLQ OperationsFilter, retry selectively, check health, purge
Automatic DLQ Retry with BackoffLet bunqueue re-queue dead entries on a backoff
DLQ ConfigurationautoRetry, maxAge, maxEntries and the defaults
DLQ ReferenceFailure reasons, entry shape, every DLQ method