Skip to main content

Overview

Throw UnrecoverableError from a job processor to immediately fail the job, bypassing any remaining retry attempts.

Class

Usage

Use UnrecoverableError when a job fails in a way that retrying won’t help:

Examples

Validation Errors

Resource Not Found

Permission Errors

Configuration Errors

Conditional Retry Logic

Comparison with Regular Errors

Regular Error (with retries)

UnrecoverableError (no retries)

Error Message

Provide clear error messages to help with debugging:

Handling Failed Jobs

Listen for failed events to handle unrecoverable errors:

When to Use UnrecoverableError

Use UnrecoverableError for:
  • Validation errors: Missing or invalid input data
  • Resource not found: Database records that don’t exist
  • Permission denied: Authorization failures
  • Configuration errors: Missing API keys or invalid settings
  • Business rule violations: Logical errors that won’t change with retries
  • 4xx HTTP errors: Client errors from external APIs
Don’t use UnrecoverableError for:
  • Network errors: Temporary connection issues
  • 5xx HTTP errors: Server errors that might be temporary
  • Rate limiting: Use RateLimitError instead
  • Timeouts: These might succeed on retry
  • Database connection errors: Temporary infrastructure issues