Execute Once Option on Function Node not working

Hi !

I’m coming here because i am facing an issue blocking me.
I think this is an n8n bug.


Issue

The issue i face is with the Function Node.
The option Execute Once doesn’t seem to work.
Indeed, the option’s description is : If active, the node executes only once, with data from the first item it receives.


Example

I made a quick workflow to illustrate the issue, in this workflow, the node Execute Only Once has the option Execute Once checked :

If you execute this workflow, you’ll be able to see the node Execute Only Once gets executed twice.


What should happen

It seems this node should be executed only once.
Is there any workaround ?

Hi @Gwendal, the Function node would run once by default for each set of items it receives, regardless of how many items there are in this set.

This is also what the Execute Once option would do so you wouldn’t need to activate it specifically for the Function node (or any of the other nodes in this list).

To see the option in action, you can use a workflow like this:

The top node (without Execute Once) would run for all five items, but the bottom one (with Execute Once) will only run for the first item:

Going back to your example: If you would like the Function node to run only once, you would need to build your flow sequentially, like so:

This way it will receive only one set of items during the execution and only run once.

Hello @MutedJam, thanks for the quick answer !

I will use this as solution, however i think this option can confuse lots of people. Would it be possible to delete it on the Function node if it doesn’t do anything on it ?

1 Like

Hi @Gwendal, I agree this can be confusing and will add this to our internal list of product suggestions.

1 Like