"[ERROR: Can’t get data for expression]" on Set node variable preview when connected to both ends of If node

This one is a bit tricky to understand, but it is most certainly an annoying bug:

On a Set node, when accessing a value from a previous node, if connected to both ends of an IF node (EDIT: at least one of them directly), the Set node can’t display the value of the variable, resulting on an “[ERROR: Can’t get data for expression]” error. This does not affect the actual functionality of the workflow, only the variable preview.

See the following workflow:

After executing the previous workflow and clicking on the “Error on display” node, it shows the following error:
image

The “No error on display” node, however, doesn’t show the error, even though it is a copy of the “Error on display” node:
image

One thing to note is that if the “Error on display” node is not connected to one of the ends of the IF node, the bug is not reproducible:

In this case, after executing the workflow, the “Error on display” node shows the variable preview as expected:

image

EDIT: If the Set node that access the previous value is not directly connected to any of the ends of the IF node, the behavior is not reproducible:

Information on your n8n setup

  • n8n version: Reproducible on both 0.212.1 and 0.226.0

Hi @miguel-mconf, thanks for reporting this and sorry for the trouble! I’ll make sure to add this to our bug tracker.

As this is mainly a display issue (your workflow is still running after all), it may take a while to get it looked at, but we’ll make sure to post an update in this thread as soon as it’s resolved :slight_smile:

Facing same issue

Same here. Just spent ages trying to debug, then found this thread :slight_smile:

1 Like

Hi folks, I am so sorry for the trouble. I’ve brought this up once again with the engineering team seeing this is affecting multiple users and will get back to you once I get feedback on this.

2 Likes

Same issue here. I was trying to understand but not sucess. Hope to resolve as soon as possible

Also facing the issue, whether it is a Switch or an If node, it’s very messy to get data from the nodes prior to those. Very difficult to build as such.
Using version 0.230.2

Thanks in advance!

Example here, getting Airtable keys from 6 nodes back with a Switch in the middle.

Hi folks, I am so sorry. Until this is fixed, can you try re-running the current node only (via the Execute node button)? This seems to fix the preview for me (thanks to @milorad for pointing this out).

1 Like

Hi @MutedJam, thanks for the feedback.

I tried rerunning the node, or the workflow but no luck with this unfortunately.

Looks like data might actually be missing in your case then which is different from what has been described in this thread.

Can you please share an example workflow using which your problem can be reproduced?

I’ll do an example workflow that I can share.
Just a quick screenshot again, the data exists in the node.
I dragged and dropped it, and it gives the error

I’ll revert to you shortly with examples

1 Like

Ok, I’ve had some progress to pinpoint the issue.

The airtable node is a list with a seach by formula. I’ve set it to “always send data”.
The next IF is checking whether or not a data field from that search action in Airtable exists, and the workflow develops accordingly.

In the workflow at the end of this message, I’ve reproduced this by having a code node, which sends a number if it’s event and an empty object if not, to mimic what the Airtable node send when it does not find a record.

Basically, when I run the workflow with the code node, it works well, with either an even or non event number in the trigger node.
But the Airtable node causes the workflow to fail if it does not find a record and sends an empty object.


Hi,
Following up, I managed a work around by using an HTTP request to Airtable’s API rather than using the Airtable node, which seems the one to blame for the issue in the end.

1 Like

Same problem here with a new workflow I just created:

Hey @CodeRider883,

Can you share more of the workflow?

Sure, I edited my post with the part of workflow involved.

So at a guess you are going over multiple emails but what is likely happening is the paired item is getting lost when you get all labels and run the function node. What I would do is change your expression to $('Split').first().json.id as you will only ever have one item at a time in that node.

1 Like

Nope but I succeed with {{ $node.Split.json.id }}

1 Like

To anyone facing this issue. I guess is with new versions. I was using a really old n8n version and it was fine. Then I updated to v1 and got this error. Then I went back to the latest 0.2 version and still got this error. However, searching the web I got a temporary fix.

n8n is not recognizing the expression with .item
You need to switch to .first()

So, if the expression is {{ $(‘NocoDB’).item.json[‘Msg Left’] }} switch to {{ $(‘NocoDB’).first().json[‘Msg Left’] }} and it will work again.

6 Likes

please guys you still didn’t fix this !! and it’s annoying a bug like this should be fixed asap !

as you can see i have the same node duplicated for the true and false output of the IF node

When the IF node outputs the true branch, the node connected to that branch shows green expressions :


BUT When the IF node outputs the false branch, the node connected to that branch shows red expressions :


Even tho the node is a duplicate of the node that has green expressions ! i don’t understand this bug and i did everything i could to find a work around !! please explain what to do