Input/output data changing randomly

Describe the problem/error/question

I am having a really hard time trying to build a flow as n8n keeps changing the input data randomly. Its like its caching back to an old input and I have to go back and forth and test and test to get the new data again.

This is a json array that I am using a loop on to try and filter out a sub array for each top level ticket and edit the fields for the data that I want, to then merge them back to the top level with the filtered note array.

In this image you can see it has done the test and got the correct input and output data.

I go to the next node and this has the correct input (output data from previous one).

But then when I click test step in this one, the output data refreshes and gets some completely incorrect data from somewhere.

Its driving me crazy and making it impossible to work out the right syntax to get it to merge back into it correctly.

Why is n8n changing the input data to something that is wrong?
I also notice it has Runs 2 of 2 in it, but there is only a single item being processed on it. I have the loop set to 1 and also set it to execute once for the testing, but somehow there is 2 runs and it makes no sense.

I got all the way up to the merge step and it seemed to be correct, but the next time I clicked test the data all changed and failed and im finding it impossible to test further.

Even pinning each step, the next step works once then goes to the wrong data unless I pin every single step.
I.e. I pinned the last step and now this one works correctly

Go to the next node, input data shows correct

Click test step, input data disppears and goes incorrect.

The only way to test this seems to be pinning the data on every single node which doesnt seem right, am i missing something obvious here?

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.68.1
  • Database (default: SQLite): sqlite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: Linux

For further info all I am wanting to achieve is filter out some fields from the ticket and filter out some fields from the notes and also remove some of the note types from the array, then end up with the json for the ticket with its filtered fields and filtered array. I am really struggling to make it work though.

(Which I seems i have finally worked out how to get it done but seems like a stuff around. But maybe its just the problem above where i kept getting wrong data show up randomly that has made this such a pain.

example json of a ticket:

[
{
"helpdesk_ticket": 
{
"id": 
51140304760,
"description": 
"Hello,\n\nWe crea in the list.",
"requester_id": 
51090543,
"responder_id": 
51025749456,
"subject": 
"Newng up",
"created_at": 
"2024-07-09T11:40:07+10:00",
"tags": 
[
],

"notes": [

{

"id": 51152355007,

"body": "user_agent: M: "[\"51000324654\"]"",

"user_id": 5104543,

"source": 4,

"incoming": false,

"private": true,

"created_at": "2024-07-09T11:40:07+10:00",

"updated_at": "2024-07-09T11:40:07+10:00",

"deleted": false,

"notable_id": 51144760,

"notable_type": "Helpdesk::Ticket",

"account_id": 2566405,

"body_html": "<div>use4654\"]"</div>",

"support_email": null,

"attachments": [

]

},

{

"id": 51159506,

"body": "Hi Ee hours are good. Ln",

"user_id": 510257456,

"source": 0,

"incoming": false,

"private": false,

"created_at": "2024-07-10T00:23:19+10:00",

"updated_at": "2024-07-10T00:23:19+10:00",

"deleted": false,

"notable_id": 51140304760,

"notable_type": "Helpdesk::Ticket",

"account_id": 2566405,

"body_html": "<div style="foniv>\n<div><br></div>\n</div>\n<div>Leon</div>\n</div>",

"support_email": "support@com",

"attachments": [

]

}
}
]

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Shadoxity

The problem is that you are referencing the same variable name every time in the node input but every node processes this variable different and therefore changes the value of it.

If you want a consistent reference to the variable you can use the node-referencing syntax in our expressions.

So instead of {{ $json['helpdesk_ticket'] }} you can reference the variable of the specific node like so {{ $('Ticket Details').item.json['helpdesk_ticket'] }}

Here’s an example demonstrating the principle (see the Filter and Set Node referencing the same firstname variable of the DebugHelper node).

Have a look in our docs here

Hope this helps :slight_smile:

1 Like

Thanks for helping to clarify that. This was helpful to better understanding how to bring that together

1 Like