What this workflow does
This workflow catches errors in your n8n automations and keeps a record in a Postgres database.
It limits sending alert emails so your inbox is not flooded.
You get detailed logs and only one alert email every 5 minutes, even if many errors happen.
How it works: Inputs → Processing → Output
Inputs
- Error event from the n8n errorTrigger node.
- Postgres table to store error logs.
- Optional alert channels like email SMTP or Pushover.
Processing Steps
- The errorTrigger node captures each error event.
- The workflow inserts detailed error info into the Postgres “N8Err” table.
- A Postgres query counts how many error records were created in the last 5 minutes.
- An If node checks if the error count is zero or less, to avoid sending many alerts.
- If allowed, alert nodes (e.g. email or push notifications) send warning messages.
- A cleanup node can delete all logs for testing purposes only.
Output
- Error logs saved permanently in your database.
- Rate-limited alert emails or notifications, max once every 5 minutes.
Who should use this workflow
This fits users who run many n8n automations and want clear, useful error reports.
It stops alert emails from drowning you when lots of errors happen at once.
It works well for both self-host n8n users and cloud users with access to Postgres.
Tools and services used
- n8n Automation Platform: To build and run the workflow.
- Postgres database: Stores error logs with detailed info.
- SMTP Email: Optional, to send alert emails.
- Pushover API: Optional, to send push notifications.
Beginner step-by-step: How to use this workflow in production
Step 1: Download and import the workflow
- Find the Download button on this page to get the workflow JSON file.
- Open the n8n editor where automations are made.
- Click on “Import from File” and select the downloaded JSON to add the workflow.
Step 2: Configure credentials and settings
- Add your Postgres database credentials in n8n credential settings.
- If you want email alerts, add SMTP email credentials in n8n.
- Update table names, schema, emails, or channels inside nodes if different from defaults.
Step 3: Test the workflow
- Trigger an error in any automation you control.
- Check the Postgres table “N8Err” to see if error details appear.
- Confirm no flood of emails is sent if multiple errors happen quickly.
Step 4: Activate the workflow
- Turn on the workflow inside n8n editor to run automatically on error events.
- Monitor logs and alerts during early use to validate operation.
Customization ideas
- Change the error alert interval in the Postgres count query from 5 minutes to your preferred time.
- Enable and set up the email or push notification nodes for live alerts.
- Add other alert channels like Slack or Microsoft Teams after the If node.
- Use a Cron node to schedule regular cleanup of old logs if needed in testing environments.
- Modify the Insert Log node SQL to save extra error info as needed.
Troubleshooting common issues
- Postgres connection refused: Check database credentials and server status.
- No logs after errors: Confirm the errorTrigger fires and the Insert Log node matches your DB schema.
- Emails sent too often: Make sure the count query outputs correctly and the If node condition is set to <= 0.
Summary
✓ The workflow captures error events automatically.
✓ Every error is logged with details inside Postgres.
✓ Alert emails are limited to once every 5 minutes when many errors happen.
→ This avoids inbox flooding and reduces wasted time.
→ You get clear error data and calm notifications to improve automation reliability.
