UnrecoverableError class. In this case, BullMQ will just move the job to the failed set without performing any retries, overriding any attempts settings used when adding the job to the queue.
Basic Usage
UnrecoverableError will cause it to fail immediately without any retries.
When to Use UnrecoverableError
Invalid Input
The job data is malformed or invalid and will never succeed
Missing Resources
A required file or resource doesn’t exist and won’t appear later
Business Logic Failure
The operation violates business rules and shouldn’t be retried
Authorization Errors
Permanent authorization failures that won’t resolve with retries
Fail Job with Manual Rate Limit
When a job is rate limited usingRateLimitError and tried again, the attempts check is ignored, as rate limiting is not considered a real error. However, if you want to manually check the attempts and avoid retrying the job, you can check job.attemptsStarted:
job.attemptsMade is increased when any error different than RateLimitError, DelayedError or WaitingChildrenError is thrown. While job.attemptsStarted is increased every time that a job is moved to active.Example: Validation Failure
Comparison: Error Types
| Error Type | Behavior | Use Case |
|---|---|---|
Error | Job retries with backoff | Temporary failures |
UnrecoverableError | Job fails immediately | Permanent failures |
RateLimitError | Job waits, then retries | Rate limit hit |
DelayedError | Job delays, then retries | Manual delay needed |
WaitingChildrenError | Job waits for children | Parent-child dependencies |
Related Resources
Retrying Failed Jobs
Learn about retry strategies and backoff
UnrecoverableError API
API reference for UnrecoverableError
Rate Limiting
Implement rate limiting for your queues
Rate Limit API
API reference for queue.rateLimit
