Infinite Loop in Workflow Execution

Hey Team!

In our workflow we are using Gmail trigger node. When manually triggering the workflow, everything functions as expected. However, upon enabling it for production, we have observed that it enters into an infinite loop.

We kindly request your assistance in investigating this matter and finding a suitable solution to resolve the infinite loop problem.


When you manually trigger the flow, it runs only once and doesn’t continuously check for new emails. Therefore, even if the email is not marked as read or moved to another folder, it won’t cause an infinite loop because the workflow is not automatically repeated.

However, when you enable the flow for production, the “Gmail Trigger” node starts checking for new emails every minute. If the same email is not marked as read or moved to another folder, it will be detected again in the next check and trigger the workflow again, creating a loop.

Try possible solution would be to add a step to your workflow to mark the email as read or move it to another folder after processing it. This will prevent the same email from being detected again in the next check


Hi @Mustafa_Ali, in addition to @weverton-sec said: Is there a chance you’re using an older version of n8n? Unfortunately you removed the details requested in the question template, making it a bit hard to understand the current status.

The reason I am asking because the Gmail node is a polling trigger node. In older versions of n8n a failure to even execute even the polling trigger node (for example because the Gmail API being polled in your workflow is temporary unavailable) could lead to such “endless” executions in the UI, despite not doing anything.

So in addition to making sure you prevent emails from being processed multiple times, you probably want to remove these old executions directly from the database and upgrade to the latest version of n8n (if you haven’t already done so).

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.