Where are the cron jobs stored?

Hi guys,

i had the problem that a cronjob of a workflow was executed which did not exist anymore.

This problem is only a user error on my part and not from n8n.

For me the only question would be: Where and how can I view and edit the cronjobs manually?

Welcome to the community @BillAlex!

They are actually not really stored anywhere. How Trigger-Nodes work in n8n (except all Webhook-based ones) is that they have a trigger function which gets executed once the workflow gets activated. That function can then also return a closeFunction which gets called once the workflow gets deactivated. In the case of the Cron-Node does it means that it starts the cron in that function and only that closeFunction can stop it. As a result is it impossible to stop it in a running n8n insance unless you deactivate the workflow.
What you can however do anytime, is to simply stop the n8n instance. Unless the workflow is activated on at the next time you start n8n would it not start that cron again.

Hope that helps!

Here the code of the Cron-Node:

In my case it would unfortunately not have helped.

2 workflows with the same name were triggered. One of them was an older version, but with the same name. So I assumed that the cronjobs are stored somewhere else than just in the SQLite database.

As a quick solution I reinstalled n8n.

Based on your description I have analyzed the situation again completely.
I think it is currently likely that 2 instances of n8n were running on different ports. So it would be possible that an old state of the workflow in the cronjob was in another instance. If I have skimmed the code of the cron node correctly, the job will be executed as it was passed when it was last saved (this n8n instance) and not as it is currently in the SQLite database.

This helps for the next time. :sweat_smile:

Yes exactly. If you have two instances running that would mess stuff up. Every time a workflow gets saved it deactivates and activates it to make sure that everything is correct. That works however only if there is only one n8n instance at any given time and not multiple ones.