Faf-skills n8n-debugger
Fix broken workflow automations and debug n8n issues. Use when troubleshooting workflow errors, failed executions, expression bugs, credential problems, or slow automations.
git clone https://github.com/Wolfe-Jam/faf-skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/Wolfe-Jam/faf-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/n8n-debugger" ~/.claude/skills/wolfe-jam-faf-skills-n8n-debugger && rm -rf "$T"
skills/n8n-debugger/SKILL.mdn8n Workflow Debugger
When to Use This Skill
Activate this skill when:
- Workflows are failing or throwing errors
- Nodes are not executing as expected
- Expressions are not evaluating correctly
- HTTP requests are failing (401, 403, 404, 500 errors)
- Data is not flowing between nodes
- Credentials are not working
- Workflows are running slowly or timing out
- Webhooks are not triggering
- Code nodes are throwing JavaScript errors
- Loop logic is not working correctly
Systematic Debugging Approach
Step 1: Identify the Error
- Check execution view for red error indicators
- Read the full error message carefully
- Note which node failed and at what step
- Check if error is consistent or intermittent
Step 2: Isolate the Problem
- Test the failing node individually (Execute Node)
- Check the input data to that node
- Verify previous nodes are outputting expected data
- Test with simplified/minimal data first
Step 3: Fix and Verify
- Apply the fix
- Test with original failing data
- Test with edge cases
- Re-run full workflow to ensure no side effects
Common Error Types & Fixes
1. Expression Errors
Error:
ERROR: Cannot read property 'X' of undefined
Causes:
- Accessing a field that doesn't exist
- Trying to read data from disconnected node
- Incorrect node name in expression
Fixes:
// ❌ Wrong - will fail if field doesn't exist {{ $json.user.email }} // ✅ Correct - use optional chaining {{ $json.user?.email }} // ✅ Correct - provide fallback {{ $json.user?.email || 'no-email@example.com' }} // ✅ Correct - check existence first {{ $json.user && $json.user.email ? $json.user.email : 'default' }}
Error:
ERROR: [invalid] is not a valid expression
Causes:
- Missing closing brackets
{{ }} - Unmatched quotes
- Invalid JavaScript syntax in expression
Fixes:
// ❌ Wrong - missing closing bracket {{ $json.name } // ✅ Correct {{ $json.name }} // ❌ Wrong - unmatched quotes {{ "text' }} // ✅ Correct {{ "text" }}
2. HTTP Request Errors
Error:
401 Unauthorized
Debug Steps:
- Check credentials are configured and selected
- Verify API key/token is valid and not expired
- Test authentication outside n8n (Postman/curl)
- Check if authentication type matches API requirements
Fix:
{ "parameters": { "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "url": "https://api.example.com/endpoint" } }
Error:
403 Forbidden
Debug Steps:
- Check if API key has required permissions
- Verify you're accessing allowed resources
- Check rate limits haven't been exceeded
- Verify IP whitelisting if applicable
Error:
404 Not Found
Debug Steps:
- Check URL is correct (spelling, case-sensitivity)
- Verify dynamic URL parts are evaluated correctly
- Test URL in browser/Postman
- Check if resource ID is valid
Fix:
// ❌ Wrong - expression not evaluated url: "https://api.example.com/users/{{ $json.userId }}" // ✅ Correct - use proper expression syntax url: "=https://api.example.com/users/{{ $json.userId }}"
Error:
500 Internal Server Error
Debug Steps:
- Check request body format (JSON syntax)
- Verify all required fields are included
- Check data types match API expectations
- Look at response body for detailed error message
Error:
Timeout Error or ETIMEDOUT
Debug Steps:
- Check if API endpoint is responding (test externally)
- Increase timeout in node options
- Check network connectivity
- Verify no rate limiting
Fix:
{ "parameters": { "options": { "timeout": 60000, // Increase from default 30000ms "retry": { "enabled": true, "maxRetries": 3, "retryInterval": 2000 } } } }
3. Data Flow Errors
Error: Node receives empty data or wrong data
Debug Steps:
- Execute previous node and inspect output
- Check connections are correct (right output index)
- Verify node name in expressions matches exactly
- Check IF/Switch conditions are evaluating correctly
Fix Conditional Logic:
{ "parameters": { "conditions": { "conditions": [ { "leftValue": "={{ $json.status }}", "rightValue": "active", "operator": { "type": "string", "operation": "equals", "caseSensitive": false // Add this if case matters } } ] } } }
Error: Data from wrong node/step
Fix:
// ❌ Wrong - using wrong node name {{ $('HTTP Request').item.json.data }} // ✅ Correct - verify exact node name (case-sensitive) {{ $('HTTP Request 1').item.json.data }} // Alternative - use item index {{ $input.item.json.data }}
4. Code Node Errors
Error:
TypeError: Cannot read property 'X' of undefined
Debug Steps:
- Add console.log() to check variable values
- Check if $input.all() returns expected data
- Verify array/object structure matches expectations
- Add null/undefined checks
Fix:
// ❌ Wrong - assumes data exists const items = $input.all(); const processed = items.map(item => ({ json: { email: item.json.user.email // Fails if user doesn't exist } })); // ✅ Correct - check existence const items = $input.all(); const processed = items.map(item => ({ json: { email: item.json.user?.email || 'no-email' } }));
Error:
Code doesn't return proper items
Fix:
// ❌ Wrong - returning wrong format return { name: 'test', value: 123 }; // ✅ Correct - must return array of objects with json property return [{ json: { name: 'test', value: 123 } }]; // ✅ Correct - for multiple items return $input.all().map(item => ({ json: { ...item.json, processed: true } }));
5. Credential Errors
Error:
Credentials not found or Credential type 'X' not supported
Debug Steps:
- Verify credential is created in n8n settings
- Check credential type matches node requirements
- Ensure credential is not expired
- Test credential with simple API call
Fix:
- Go to Settings → Credentials
- Create new credential of correct type
- Test credential
- Select in node dropdown
6. Loop/Batch Errors
Error: Loop runs forever or doesn't loop
Debug Steps:
- Check Split In Batches is connected correctly
- Verify loop-back connection goes to Split node
- Check batch size is reasonable
- Add counter to track iterations
Fix:
[Trigger] → [Get All Items] → [Split In Batches] → [Process Batch] → [Loop Back] ↓ (done output) [After Loop Done]
Connections must be:
{ "connections": { "Split In Batches": { "main": [ [ { "node": "Process Batch", "type": "main", "index": 0 } ] ] }, "Process Batch": { "main": [ [ { "node": "Split In Batches", // Loop back here! "type": "main", "index": 0 } ] ] } } }
7. Webhook Errors
Error: Webhook not triggering
Debug Steps:
- Check webhook URL is correct
- Verify workflow is active (not just saved)
- Check webhook method matches (GET/POST)
- Test with curl/Postman
- Check firewall/network access
Test Webhook:
# Test webhook with curl curl -X POST https://your-n8n.com/webhook/your-path \ -H "Content-Type: application/json" \ -d '{"test": "data"}'
Error: Webhook receives data but doesn't process
Debug Steps:
- Check response mode setting
- Verify workflow executes after webhook
- Check for errors in downstream nodes
- Review webhook execution logs
8. Variable/Context Errors
Error: Can't access data from earlier in workflow
Fix:
// ❌ Wrong - only accesses current item {{ $json.value }} // ✅ Correct - access specific previous node {{ $('Node Name').item.json.value }} // ✅ Correct - access all items from previous node {{ $('Node Name').all() }} // ✅ Correct - access first item {{ $('Node Name').first().json.value }}
Debugging Tools & Techniques
1. Enable Detailed Logging
Add Code nodes to log data:
// Log current item console.log('Current item:', JSON.stringify($input.item.json, null, 2)); // Log all items console.log('All items:', JSON.stringify($input.all(), null, 2)); // Return data unchanged return $input.all();
2. Use Set Node for Debugging
Add a Set node to inspect data structure:
{ "parameters": { "mode": "manual", "assignments": { "assignments": [ { "name": "debug_input", "value": "={{ JSON.stringify($json) }}", "type": "string" }, { "name": "debug_keys", "value": "={{ Object.keys($json).join(', ') }}", "type": "string" } ] } } }
3. Test with Minimal Data
Create a Set node with test data:
{ "parameters": { "mode": "manual", "assignments": { "assignments": [ { "name": "id", "value": "123", "type": "string" }, { "name": "name", "value": "Test User", "type": "string" } ] } } }
4. Binary Search Debugging
- Disable half the workflow
- Execute to find which half has the error
- Re-enable and disable half of the problematic half
- Repeat until you find the exact failing node
5. Check Execution History
- Go to Executions tab
- Find the failed execution
- Click to view details
- Review each node's input/output
- Check error messages
Performance Debugging
Slow Workflow Execution
Debug Steps:
- Check execution time for each node
- Identify bottleneck nodes
- Look for unnecessary loops
- Check for large data transfers
Optimizations:
// ❌ Slow - processing items one at a time // (Run once for each item mode) // ✅ Faster - batch processing // (Run once for all items mode) const items = $input.all(); const processed = items.map(item => ({ json: { ...item.json, processed: true } })); return processed;
Memory Issues
Symptoms:
- Workflow crashes mid-execution
- Browser becomes unresponsive
- Long delays between node executions
Fixes:
- Use Split In Batches for large datasets
- Reduce batch sizes (try 10-50 items per batch)
- Clear unnecessary data with Set node
- Avoid storing large binary files in workflow
Quick Diagnostic Checklist
When a workflow fails, check:
- Error message in execution view
- Previous node's output data
- Expression syntax (brackets, quotes)
- Node names are correct (case-sensitive)
- Connections are correct (right output index)
- Credentials are configured and valid
- HTTP URLs are correct and accessible
- Required fields are populated
- Data types match expectations
- IF/Switch conditions evaluate correctly
- Code node returns proper format
- Workflow is active (for webhooks)
Common Fixes Quick Reference
| Error Type | Quick Fix |
|---|---|
| Add null checks: or |
| 401/403 | Check credentials & permissions |
| 404 | Verify URL and resource ID |
| 500 | Check request body format |
| Timeout | Increase timeout & add retries |
| Expression error | Check brackets |
| Wrong data | Verify node names in expressions |
| Code error | Return format |
| Loop stuck | Check loop-back connection |
| Webhook not firing | Activate workflow |
Skill Control
To disable this skill temporarily:
mv ~/.claude/skills/n8n-debugger ~/.claude/skills/n8n-debugger.disabled
To re-enable:
mv ~/.claude/skills/n8n-debugger.disabled ~/.claude/skills/n8n-debugger
Made with 🧡 by wolfejam.dev Fix ALL the bugs! 🐛✨