WaitingError is a special error class used to signal that a job has been manually moved back to the waiting state during processing. This error prevents the worker from trying to complete or fail the job.
Class Definition
Usage
When you manually move a job to wait usingjob.moveToWait(), you must throw WaitingError to signal to the worker that the job has been intentionally moved and should not be marked as completed or failed.
When to Use
Manual Retry
Retry a job immediately without incrementing attempts counter
Rate Limiting
Move job back to wait when hitting external rate limits
Resource Contention
Retry when a required resource is temporarily unavailable
Conditional Processing
Re-queue job based on dynamic conditions
Important Notes
WaitingError does not increment the attemptsMade counter, but it does increment attemptsStarted. This is useful for implementing custom retry logic without exhausting the configured retry attempts.Example with Rate Limiting
Comparison with Other Errors
| Error Type | Job State | Attempts Counter | Use Case |
|---|---|---|---|
WaitingError | wait | Not incremented | Manual retry |
DelayedError | delayed | Not incremented | Manual delay |
RateLimitError | wait | Not incremented | Rate limiting |
WaitingChildrenError | waiting-children | Not incremented | Parent-child dependencies |
Regular Error | failed → wait | Incremented | Standard retry |
Related Resources
Manual Retrying Pattern
Learn about manual retry strategies
Job.moveToWait API
API reference for moveToWait method
Rate Limiting
Implement rate limiting strategies
Process Step Jobs
Multi-step job processing patterns
