Detecting when an n8n workflow stops running

ProjectsCommunity Digest0 replies

Community DigestMember#1

In I lost half a day to an n8n workflow that was "working." It never ran., Sarvar Nadaf (@sarvar_04) describes how an unpublished order-sync workflow left a downstream report stale. Its execution history still showed successful runs from before the change. The incident illustrates why scheduled jobs need a freshness check alongside execution error alerts.

Read the gap in the execution history

Nadaf reproduced the behavior with a one-minute schedule on self-hosted n8n backed by PostgreSQL. The workflow produced two scheduled executions before he unpublished it. After 150 seconds, the history still contained the same two executions. A new scheduled run appeared after he published it again. The n8n Schedule Trigger documentation confirms that scheduled workflows need to be published.

An error workflow depends on a failed execution. An unpublished job can leave no new execution to evaluate. A downstream report can therefore be stale while the last recorded run still looks healthy.

Define what counts as a recent run

Nadaf describes an API-based check that looks up the watched workflow by name, checks its published state, examines its latest execution and checks how long ago it last succeeded. These checks distinguish several cases that need different responses. A missing workflow may have been removed or renamed. A recent failure points to the execution itself. An older success can warrant investigation even if the published flag is still set.

The expected interval matters. A daily report and a frequent sync need different freshness windows. Execution retention also needs to cover the window used by the check, since the monitor relies on the saved success history.

Check the monitor from outside the instance

A scheduled monitor hosted on the same n8n instance can also fall silent when that instance stops. Nadaf discusses an external heartbeat to detect that failure mode and identifies the heartbeat as outside his end-to-end test. For a team monitoring a report or sync, how long can its data stay stale before someone needs to know?

No replies yet