IOLEBA

 IOLEBA N8N Textbook – Table of Contents

Chapter 10: Error Handling and Debugging - Part 1
Chapter 10 - Part 1 of 3

Error Handling and Debugging

Introduction

Building workflows is one thing; making them reliable in production is another. This chapter teaches you to anticipate failures, handle errors gracefully, debug issues efficiently, and create monitoring systems that keep your automations running smoothly. These skills separate hobby projects from production-ready business automation.

Understanding Workflow Errors

Common Error Types

Error Type Cause Example
Connection Error Network issues, service down Cannot reach API endpoint
Authentication Error Invalid credentials, expired tokens 401 Unauthorized, 403 Forbidden
Data Validation Error Missing required fields, wrong format Email field empty, invalid date
Rate Limiting Too many requests 429 Too Many Requests
Timeout Operation took too long Database query exceeded 30s
Logic Error Incorrect workflow design Accessing undefined property

Node-Level Error Handling

Continue On Fail

The most basic error handling option - allows workflow to continue even when a node fails.

When to Use Continue On Fail:
  • Optional operations: Logging, analytics, notifications
  • Multiple parallel tasks: Don't want one failure to stop all
  • Graceful degradation: Continue with reduced functionality
How to Enable:
  1. Click node to open settings
  2. Go to "Settings" tab
  3. Enable "Continue On Fail"
  4. Node will pass error data to next node instead of stopping

Retry On Fail

Automatically retry failed operations - essential for transient errors.

Retry Configuration:
  • Max Tries: Number of retry attempts (recommend 3-5)
  • Wait Between Tries: Delay before retry (milliseconds)
  • Strategy: Fixed delay or exponential backoff
Best Practices:
  • Use for network-dependent operations
  • Implement exponential backoff for rate limits
  • Set reasonable max tries to avoid infinite loops
  • Don't retry for 4xx errors (bad request, unauthorized)
  • Do retry for 5xx errors (server issues) and network errors

Timeout Settings

Prevent workflows from hanging indefinitely on slow operations.

⚠️ Timeout Recommendations:
Operation Type Recommended Timeout
Simple API calls 10-30 seconds
Database queries 30-60 seconds
File uploads/downloads 2-5 minutes
Heavy processing 5-10 minutes

Workflow-Level Error Handling

Error Trigger Workflow

Create dedicated workflows that handle errors from other workflows.

Error Workflow Setup:
  1. Create new workflow
  2. Add "Error Trigger" node as first node
  3. Configure which workflows it monitors (specific or all)
  4. Build error handling logic:
    • Parse error details
    • Categorize error severity
    • Send notifications
    • Log to external system
    • Create support tickets for critical errors

Error Data Structure

What's Available in Error Trigger:

Error data includes execution ID, workflow details, node information, error message, stack trace, and timestamp.

Conditional Error Handling

IF Node Error Checking

Check for errors and handle them conditionally within workflows.

Pattern: Try-Catch in n8n
  1. Enable "Continue On Fail" on risky node
  2. Add IF node after it
  3. Check for error presence
  4. True path (Error): Handle error
    • Log error details
    • Send notification
    • Use fallback data
  5. False path (Success): Continue normal flow
Example: API Call with Fallback

Step 1: HTTP Request (Continue On Fail: true) - Try to fetch user data from API

Step 2: IF Node - Check if error exists

TRUE: Use API data

FALSE: Use cached/default data

Step 3: Continue workflow with best available data

Continue to Part 2

Part 2 covers: Debugging Techniques, Logging Strategies, and Monitoring

Part 3 covers: Performance Debugging, Common Scenarios, and Practice Exercises

n8n Textbook | Chapter 10: Error Handling and Debugging - Part 1

© 2025 IOLEBA | Dr. Marcus Lee

Chapter 10: Error Handling and Debugging - Part 2
Chapter 10 - Part 2 of 3

Error Handling and Debugging (Continued)

Debugging Techniques

Using Execution History

Execution History Features:
  • View all executions: Success, failed, running
  • Inspect data: See input/output for each node
  • Timeline view: Understand execution flow
  • Error messages: Full stack traces
  • Filter/search: Find specific executions
Navigation:
  1. Click "Executions" in left sidebar
  2. Select execution to inspect
  3. Click nodes to see their data
  4. Review error details for failed nodes

Testing Individual Nodes

Isolate Problems:
  1. Open workflow in editor
  2. Click "Execute Workflow" to get initial data
  3. Click problematic node
  4. Click "Execute Node" to test just that node
  5. Review input data and output
  6. Adjust configuration
  7. Repeat until working

Using Set Nodes for Debugging

Debug Pattern:
  1. Insert Set node before problem area
  2. Use it to view/transform data
  3. Add debug properties for tracking
  4. Execute and inspect Set node output
  5. Remove Set node when debugged

Logging Strategies

What to Log

Log Type When to Log What to Include
Success Critical operations complete Timestamp, operation, record count
Error Any failure Error message, node, stack trace
Warning Unexpected conditions Condition, potential impact
Audit Data changes What changed, who, when
Performance Slow operations Duration, resource usage

Logging Destinations

Where to Send Logs:
  • Google Sheets: Simple, searchable, free
  • Database: Structured, queryable, scalable
  • File: Local storage, rotating logs
  • External Services: Loggly, Datadog, Splunk
  • Email/Slack: Critical errors only

Log Format Example

Structured Log Entry:

Include timestamp, workflow ID, execution ID, log level, node name, error message, and relevant details like customer email or retry information.

Monitoring Production Workflows

Health Check Workflow

Pattern: Daily Health Checks
  1. Schedule Trigger: Daily at 9 AM
  2. Query Execution History: Check last 24 hours
  3. Calculate Metrics:
    • Total executions
    • Success rate
    • Failed workflows
    • Average execution time
  4. IF Node: Success rate less than 95%?
  5. Alert: Send warning to team
  6. Report: Email daily summary

Alerting Rules

Severity Condition Action
Critical Payment processing fails SMS + Slack + Email immediately
High Customer-facing workflow fails Slack notification + Create ticket
Medium Non-critical operation fails Log + Daily summary email
Low Warning conditions Log only

Performance Debugging

Identifying Slow Nodes

Performance Analysis:
  1. Review execution timeline in history
  2. Identify nodes taking excessive time
  3. Common culprits:
    • API calls without pagination
    • Processing large datasets in memory
    • Inefficient database queries
    • Multiple sequential API calls

Optimization Strategies

Speed Up Workflows:
  • Parallel processing: Split independent operations
  • Batch operations: Process items in groups
  • Pagination: Handle large datasets in chunks
  • Caching: Store frequently accessed data
  • Async operations: Don't wait for non-critical tasks
  • Database indexes: Speed up queries

Continue to Part 3

Part 3 covers: Common Debugging Scenarios, Practice Exercises, Week 2 Completion Milestone, and Key Takeaways

n8n Textbook | Chapter 10: Error Handling and Debugging - Part 2

© 2025 IOLEBA | Dr. Marcus Lee

Chapter 10: Error Handling and Debugging - Part 3
Chapter 10 - Part 3 of 3

Error Handling and Debugging (Final)

Common Debugging Scenarios

Scenario 1: Data Not Reaching Node

Problem: Node shows "No data"

Debugging Steps:

  1. Check previous node's output
  2. Verify connection between nodes
  3. Check IF node conditions (might be filtering out data)
  4. Review merge node settings
  5. Look for errors in earlier nodes

Scenario 2: Expression Errors

Problem: "Cannot read property of undefined"

Solutions:

  • Use optional chaining in expressions
  • Check if property exists first
  • Inspect actual data structure in previous node
  • Use Set node to view intermediate data

Scenario 3: Intermittent Failures

Problem: Workflow works sometimes, fails others

Common Causes:

  • Rate limiting (works until quota exceeded)
  • Race conditions in parallel operations
  • External service reliability issues
  • Inconsistent input data format

Solutions:

  • Add retry logic with backoff
  • Implement data validation early in workflow
  • Add logging to identify patterns
  • Use error triggers to catch and analyze failures

Practice Exercises

Exercise 1: Build Error Workflow

Create comprehensive error handling:

  1. Create Error Trigger workflow
  2. Parse error details
  3. Categorize by severity (critical, high, medium, low)
  4. Send appropriate notifications
  5. Log to Google Sheets
  6. Create Slack thread for critical errors
Exercise 2: Implement Retry Logic

Build resilient API integration:

  1. HTTP Request with Continue On Fail
  2. IF: Check for error
  3. IF: Check retry count less than 3
  4. Wait node (exponential backoff)
  5. Loop back to retry
  6. After max retries: Send alert and stop
Exercise 3: Monitoring Dashboard

Create workflow health monitoring:

  • Schedule trigger (every hour)
  • Query execution statistics
  • Calculate success rates per workflow
  • Identify slowest executions
  • Update monitoring spreadsheet
  • Alert if any workflow less than 90% success

🎉 Week 2 Complete: Core Skills Mastered!

You've completed Chapters 6-10 and learned:

  • ✅ Advanced node types and configurations
  • ✅ Database integrations (SQL & NoSQL)
  • ✅ API authentication methods
  • ✅ Webhook workflows
  • ✅ Error handling and debugging

Ready for Week 3: Advanced Techniques!

Key Takeaways

  • Anticipate failures - they WILL happen in production
  • Use Continue On Fail for optional operations
  • Implement retry logic with exponential backoff
  • Create error trigger workflows for centralized error handling
  • Log strategically - balance detail with noise
  • Monitor production workflows actively
  • Test individual nodes when debugging
  • Use execution history to understand failures

Looking Forward

In Week 3 (Chapters 11-15), you'll dive into advanced techniques including complex data transformations, API integration patterns, advanced authentication, scheduling strategies, and performance optimization. These skills will elevate your workflows from functional to professional-grade.

📥 Download This Chapter

Your browser's print dialog will open - select "Save as PDF" as the destination

n8n Textbook | Chapter 10: Error Handling and Debugging - Part 3

© 2025 IOLEBA | Dr. Marcus Lee

Originally Published: November 2025