Stop Workflow when Error occurs

Hi there,

i have a workflow which is started every half hour by an interval trigger. If an error occurs, my error workflow starts and sends me an e-mail with the information that I have to fix the error in my workflow.

My question is if there is a possibility to stop the workflow via a function or something similar so that I don’t get an email every half hour when I just don’t have time to fix the error in the workflow.

Does anybody have a suggestion?

Hey @nkos!

Welcome to the community! :slightly_smiling_face:

Can you please let me know how are you using n8n? Are you running it locally or have you hosted it on the cloud, or are you using n8n cloud? Knowing how you’re using n8n, will help me suggest you a solution accordingly.

Hi @harshil1712 ,

thank you for your reply.

I am running it locally.

Since you’re running it locally you can use the Execute Command node, and use the command n8n update:workflow --id=<ID> --active=false. Replace <ID> with your workflow’s ID. You can get the workflow ID from the URL http://localhost:5678/workflow/<ID>.

I hope this helps. :slightly_smiling_face:

2 Likes

Thank you @harshil1712 , that worked :slightly_smiling_face:

And what would I have to do when I have n8n hosted in the cloud?