Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
What is the primary purpose of moving a permanently failed job into a dead letter queue, rather than simply discarding it?
💻 Code Challenge | +75 XP
Implement a failed-job handler that moves a job to a dead letter queue after exhausting all retries, preserving the original payload and error message, and triggers an alert when a new DLQ entry is added.
A production incident was only discovered a week after it started because failed jobs had been silently accumulating with no alerting in place. Reorder the steps to fix this using a properly monitored DLQ.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Allowing a permanently failed job to simply be discarded with no dead letter queue or record at all
// Wrong: permanently failed job vanishes with zero trace
worker.on("failed", () => { /* nothing */ });
// Correct: preserved for investigation
worker.on("failed", async (job, err) => {
if (job.attemptsMade >= job.opts.attempts) await dlq.add("failed", { job: job.data, error: err.message });
});The Solution //
A silently discarded job represents both lost work and lost evidence that a real problem occurred — without a DLQ preserving the failure context, there's no way to investigate what went wrong, and the underlying issue can remain completely invisible until its downstream effects eventually surface elsewhere, often much later and harder to trace back.
The Error //
Setting up a dead letter queue but with no alerting configured for new entries
// Insufficient alone: entries accumulate, but nobody is notified
await dlq.add("failed", entry);
// Correct: someone is actually notified promptly
await dlq.add("failed", entry);
await alertOncall(`New DLQ entry: ${entry.error}`);The Solution //
A DLQ that silently accumulates entries with nobody actively monitoring it provides little practical benefit over discarding failed jobs outright — the failure record exists, but nobody becomes aware of it until someone happens to manually check the DLQ, which could be far too late. Configure an explicit alert triggered whenever a new entry lands in the DLQ.