Automate n8n Workflow Error Notifications with Gmail

Struggling with missed error alerts in your n8n workflows? This automation catches failed workflows and sends structured Gmail notifications, ensuring you never miss critical error alerts again.
errorTrigger
n8n
gmail
+3
Workflow Identifier: 1523
NODES in Use: Error Trigger, n8n, Gmail, Code, If, Schedule Trigger

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow finds any active n8n workflows that do not have an error handler set.
It then sets a default error handler automatically for them.
After that, it watches for workflow failures and sends email notifications instantly.
This stops missed errors and keeps you informed fast.


How the Workflow Works

Inputs: The workflow starts using a scheduled time trigger every day at midnight.
It also gets the ID of the error handler workflow itself to use later.

Processing Steps: It fetches all active workflows from the n8n instance using the API.
Then, it filters only those that are active, have no error handler, and are not the default error handler workflow.
For each filtered workflow, it updates the settings to assign the error handler workflow ID as their error handler.
Finally, an Error Trigger node listens for any workflow errors across n8n.

Output: When a workflow fails, an email is sent immediately with the name of the failed workflow and a link to the error details.
This way, you get fast alerts of problems so you can fix them quickly.


Who Should Use This Workflow

This is helpful for anyone running many n8n workflows who wants to catch failures fast.
It fits users managing dozens or hundreds of workflows and who want automatic error notification setup.

No need to check each workflow manually or risk missing alerts.
It works well for teams using self-host n8n or n8n cloud.


Tools / Services Used

  • n8n Automation Platform API: To get and update workflows programmatically.
  • Gmail with OAuth2: To send email alerts on workflow failures.
  • n8n Nodes: Schedule Trigger, If, Code, Error Trigger, Gmail node.

Beginner Step-by-Step: How to Use This Workflow in n8n

Import Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open your n8n editor where you manage workflows.
  3. Click on “Import from File” and select the downloaded workflow JSON file.

Configure Credentials

  1. Go to each n8n node that connects to APIs (like the n8n API nodes and Gmail node).
  2. Add or select your valid API credentials or OAuth2 keys.
  3. Make sure the Gmail node’s “sendTo” field has your email address or team emails.

Update IDs and Emails

  1. If needed, update any workflow IDs or email addresses used inside the nodes.
  2. Check the Code node with the JavaScript code to confirm it gets the correct error handler workflow ID.

Test the Workflow

  1. Manually trigger the Schedule Trigger to run the workflow once.
  2. Watch execution logs to ensure workflows without error handlers get updated.
  3. Cause a test error in a sample workflow to verify the email notification arrives.

Activate for Production

  1. Once tests pass, toggle the workflow live in n8n.
  2. Let it run daily to maintain error handlers and receive error alerts.

This lets you use the workflow immediately for automated error management.
If hosting n8n on your own server, check resources like self-host n8n for setup help.


Code for Updating Workflow Error Handler

The Code node uses JavaScript to update each workflow’s error handler.
This script gets the workflow JSON, sets the errorWorkflow field to the error handler workflow ID, and returns updated data.

const data = $json;

// Assign errorWorkflow to the error handler ID we got earlier
 data.settings.errorWorkflow = $('get error handler').item.json.id;

// Remove the callerPolicy to avoid conflicts
 delete data.settings.callerPolicy;

// Return updated workflow information
 return {
   id: data.id,
   name: data.name,
   nodes: data.nodes,
   connections: data.connections,
   settings: data.settings
 };

This script makes the update task fast and automatic for many workflows at once.


Customizations ✏️

  • Change the Gmail node to Slack or Microsoft Teams nodes to send error alerts to chat instead of email.
  • Adjust the Schedule Trigger time or frequency to suit your needs better.
  • Add multiple email addresses separated by commas in the Gmail node to notify a bigger team.
  • Enhance the email content with extra details like error message or timestamps in the Gmail node message.
  • Create a less noisy error handler workflow that logs errors silently without notifications for test environments.

Troubleshooting 🔧

  • Issue: No workflows update or no error emails received.
    Cause: Wrong or expired API credentials in n8n or Gmail nodes.
    Fix: Re-authenticate under n8n credentials and test the workflow manually.
  • Issue: Gmail node shows authentication or quota errors.
    Cause: Gmail API limits hit or OAuth token expired.
    Fix: Check Google API console, renew OAuth tokens, or create new credentials.
  • Issue: Infinite update loop on error handler workflow.
    Cause: Error handler workflow setting itself as error handler.
    Fix: If node excludes the error handler workflow by ID properly. Verify this condition matches your actual workflow ID.

Pre-Production Checklist ✅

  • Make sure Gmail OAuth2 credentials have permission to send emails.
  • Trigger the Schedule Trigger node manually to confirm workflows fetch correctly.
  • Check the If node output to confirm only workflows without error handlers pass through.
  • Create a test error in a workflow to verify email notification is sent fast.
  • Backup all current workflow settings before activating this automation for rollback safety.

Deployment Guide

Turn on the workflow by toggling it live in your n8n editor.
Watch the execution logs for successful updates and error emails.

Set up error log monitoring on the n8n server or via your hosting platform.
Optionally set alert escalation if emails stop being sent.


Summary

✓ Automates setting default error handlers for workflows without one.
✓ Sends immediate Gmail alerts when workflows fail.
✓ Saves time by avoiding manual error checking.
✓ Keeps automation running smoothly with fast failure awareness.
✓ Works with many workflows and scales for large n8n installations.


Frequently Asked Questions

Yes, n8n supports other email services via SMTP, Outlook, and more nodes which can replace the Gmail node.
The workflow uses n8n API calls daily which are light, but usage depends on the instance API limits.
Yes, OAuth2 secures Gmail access, and n8n API credentials limit workflow information access safely.
Yes, it is designed to scale well, though very large instances may require tuning for performance.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free