Skip to main content

Error Handling

n8n provides comprehensive error handling mechanisms at multiple levels: node-level, workflow-level, and system-level. Understanding these mechanisms helps you build resilient workflows that gracefully handle failures.

Error Types

n8n uses a hierarchical error system with specific error classes:

Node Errors

Errors that occur during node execution:
When to use:
  • Invalid credentials
  • API rate limiting
  • Invalid parameters
  • Business logic errors
Example:

Node-Level Error Handling

Retry Configuration

Nodes can automatically retry on failure:
1

First Attempt

Node executes normally. If it succeeds, execution continues.
2

Failure Detected

If the node throws an error and retryOnFail is true, the retry mechanism activates.
3

Wait Period

System waits for waitBetweenTries milliseconds before retrying.
4

Retry Attempts

Node executes again. This continues up to maxTries times.
5

Final Result

  • If any attempt succeeds, execution continues
  • If all attempts fail, error handling logic applies

Continue on Fail

Control whether workflow execution stops on node failure:

Error Data Structure

When alwaysOutputData is true, failed items include error information:

Workflow-Level Error Handling

Error Workflow

Configure a dedicated error workflow to handle failures:
The error workflow receives:
Error workflows run in error mode and receive the complete error context, allowing you to:
  • Send error notifications (email, Slack, etc.)
  • Log errors to external services
  • Trigger recovery workflows
  • Store error details for analysis

Error Trigger Node

The Error Trigger node starts workflows when errors occur:

Execution-Level Error Handling

Execution Errors

The execution engine tracks errors throughout workflow execution:

Timeout Handling

Manual Cancellation

Error Recovery Patterns

Pattern 1: Graceful Degradation

Continue with default values when optional operations fail:

Pattern 2: Error Notification

Notify team when critical operations fail:
1

Configure Error Workflow

Set error workflow in workflow settings
2

Add Error Trigger

Start error workflow with Error Trigger node
3

Send Notification

Use Slack, Email, or webhook to alert team

Pattern 3: Fallback Service

Try alternate services if primary fails:

Pattern 4: Exponential Backoff

Implement custom retry with increasing delays:

Error Context and Debugging

Error Context Information

Errors include detailed context for debugging:

Accessing Error Details

In error workflows or subsequent nodes:

Best Practices

  1. Set appropriate retry counts: Too many retries can delay error detection
  2. Use meaningful error messages: Include context for debugging
  3. Configure error workflows: Set up centralized error handling
  4. Handle errors close to source: Use continueOnFail judiciously
  5. Log errors appropriately: Balance detail with noise
  6. Test error scenarios: Deliberately trigger errors to test handling
  7. Document error handling: Explain expected failures in workflow notes
  8. Monitor error rates: Track and alert on unusual error patterns
Testing Error Handling:
  1. Use the “Test workflow” button with invalid data
  2. Temporarily set incorrect credentials to test auth errors
  3. Use the IF node to simulate random failures
  4. Test timeout behavior with long-running operations
  5. Verify error workflows receive correct data

Common Error Scenarios

API Rate Limiting

Transient Network Errors

Optional Operations

Critical Operations

Next Steps

Execution Modes

Understand how workflows execute in different contexts

Creating Workflows

Learn more about workflow structure and design