Library / Monitoring, Ops & Incidents
Monitoring, Ops & Incidents
Diagnose failed n8n workflows with Ollama and post triage to Discord
Runs as the error workflow for other n8n workflows, fetches the failed execution, redacts secrets, has a local Ollama model diagnose it and posts a triage report to Discord.
What it does
## Diagnose failed n8n workflows with a local Ollama model and post to Discord ### Who's it for Anyone running n8n who gets failure alerts but still has to open the execution to work out what went wrong, and who wants that analysis to stay on their own hardware. ### How it works 1. Runs as the error workflow for your other workflows, as a sub-workflow called by an existing error handler, or from the test trigger. 2. Fetches the failed execution and the workflow definition through the n8n API. Trigger failures with no execution fall back to the error message. 3. Redacts tokens, JWTs, emails, keyed URLs and webhook URLs before anything reaches the model. 4. Skips repeats: the same workflow, node and error within dedup_hours is diagnosed once, so a failing schedule can't flood the channel. 5. A local model returns schema-checked JSON: what broke, likely cause, suggested fix, fix type, confidence and risk. 6. A Code node checks the model's labels, formats the message and posts it to Discord. Nothing is changed in the failing workflow. ### Setup - n8n API credential (Settings > n8n API) - Ollama reachable from n8n; set ollama_url and model in Build Config - A data table triage_history: text columns fingerprint, workflow_id, workflow_name, failed_node, error_message, execution_id, fix_type, and a date column diagnosed_at. Select it in both data table nodes. - A Discord webhook credential - Set n8n_editor_url, and add your error handler's ID to excluded_workflow_ids - Point workflows' Error workflow setting here, or call it from your error handler (companion template: *Send n8n workflow failure alerts to Discord*) ### Limits Only sees runs that fail. An expression that reads a missing field returns empty and the run succeeds, so add data checks for those. Nodes referenced with $(): Skip Excluded Workflows, Get Failed Execution, Redact and Build Context, Skip Repeat Failures, Format Diagnosis.
The steps
- On Workflow Error
- Normalize Failure
- Test with Sample Failures
- Sample Failures
- Build Config
- Skip Excluded Workflows
- Get Failed Execution
- Get Workflow Definition
- Redact and Build Context
- Diagnose Failure
- Format Diagnosis
- Post Diagnosis to Discord
- Called by Error Handler
- Get Recent Diagnoses
16 steps in total.
Similar automations
Monitoring, Ops & IncidentsDiagnose solar production losses with SolarEdge, Open-Meteo, Gemini, Postgres, Jira and21 stepsMonitoring, Ops & IncidentsSend n8n Audits and Failed Workflows to InfluxDB24 stepsEmail AutomationDiagnose RAG chunk strategies from Google Drive PDFs with Gemini and Google Sheets31 stepsMonitoring, Ops & IncidentsSend n8n workflow failure alerts to Discord and log them in Data Table7 steps