Describe the problem/error/question
I have been using n8n for the past year and haven’t had any issue like this one. I have 3 workflows set up to be executed in a sequence: first is triggered by a webhook call, then the following via execute workflow triggers. The first two workflows execute fine, but when execution reaches the third and final workflow something strange happens: when I check the execution of the workflow, I see that the output of the first code node has the output that should produce the third code node in that workflow! Then that output is treated as the “correct” output, so the following nodes process the incorrect data.
What is the error message (if any)?
There is no error message, since the workflow executes successfully.
Please share your workflow
Share the output returned by the last node
Since the aim of this flows is to process recipes for a diet creation app, the inputs and outputs of data are big so I’ll try to summarize it.
Workflow input:
{
[
"dietDays": [
{
"meal1":{
"dish1":[
{
// Recipe objects
},
...
],
"dish2":[...],
...
},
"meal2":{...},
...
}
]
]
}
A recipe object has been generated in previous workflow, as well as inserted to mongodb. It has a preparation, a list of ingredients, etc. Code node “Code” of this workflow gets some data from mongo (fields _id, meanMacros,etc) and appends them to current recipe objects.
Expected structure of a recipe object in “Code” output":
{
"_id":"xxxx", // Appended by "Code" node
"mean_macros": [], //Appended by "Code" node
"mean_foods": [], //Appended by "Code" node
"ingredients":[],
"preparation":"",
"name":"",
...
}
Current output of recipe object of “Code” node:
{
"_id":"xxxx", // Appended by "Code" node, not modified
"calories": 0, // Appended by "Code 2" node!!
"foodQuant": [], // Appended by "Code 2" node!!
// No more fields, meaning the deletion instructions in "Code 2" were executed
}
Things I have tried
- I was able to know when the problem occurs by executing the workflow and producing errors or stopping the execution with a filter node. After a lot of attempts, it seems that if the flow reaches code node “Code 2” then its output is automatically assigned to output of code node “Code”. If the execution stops (because of errors or flow not reaching “Code 2”) then all nodes’ outputs are OK.
- I’ve tried to delete the node and copying the code to a new node to “refresh it”.
- I’ve tried to change the code of “Code 2”, the output assigned to node “Code” changes accordingly!
- I’ve tried to change order of nodes: put “Item Lists 1” (which splits a collection) before “Code 2” and change code to run once per item. In this case, node “Code 2” was completely ignored by execution flow!
- I’ve tried to pin data to a “Manual execution” node and connecting it to the different nodes. For some reason, I did not experience any issue whatsoever!
- I’ve tried to move code nodes to the previous workflow. Did not work.
- I’ve tried to replicate the workflow (no copying and pasting) into a freshly created workflow. Did not work.
- I’ve tried restarting n8n.
- The issue was detected while using n8n version 0.236, so I’ve also tried updating to 0.237, but this also did not work.
Information on your n8n setup
- n8n version: 0.237.0
- Database (default: SQLite): default
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): npm
- Operating system: Rocky Linux 9.0
TL;DR
Output of node goes back in time and replaces output of first node, giving out strange results.