Issue carrying values from previous nodes - can't get data for expression


I’ve repeatedly run into issues attempting to pull values from previous nodes, typically when those nodes are more than 2 nodes back.

The only way I’ve been able to resolve this is by adding extra Set nodes to reset values that are further back in the chain.

Please see this video for reference: Dropbox - - Simplify your life

In the above video and screenshots, my ‘SetValues-NotesGiven’ node was the workaround used to reset the values needed. However, the ‘SetValues’ node (4 nodes back) contains the exact same data, but for some reason throws ‘[ERROR: Can’t get data for expression]’ when I try to use it in my node.

If possible, I would like to pull values from the original ‘SetValues’ node, instead of adding many unnecessary Set nodes throughout my workflow.

I’m happy to share additional information if needed.

I appreciate any support - thank you!

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:
  • n8n version: 1.7.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system:

Hey @billybjork,

Welcome to the community :cake:

Can you share the workflow? There are a few things that can cause the data to not be available like using a code, merge, if or switch node if the item link has been lost.

Hey Jon, thanks for the support!

Here’s a screenshot of my full workflow. You’ll see that there is a switch node before ‘Nodes Given (to creator)’, which may be part of the issue per your comment. There are also code nodes, which produce some of the values I’m attempting to connect.

All of the Set nodes (aside from ‘Generate timestamp’) are used as a workaround to reset values that I can’t get data for, presumably because they’re too many nodes back.

Hey @billybjork,

Could you execute the workflow and show the same image but with the coloured lines so I can see the route that has been taken?

Apologies for not sending this previously. In the screenshot above, the ‘Reset Values - Notes Given’ node is redundant and ideally could be removed.

Hey @billybjork,

That looks like it should work, I am wondering if maybe the issue is possibly related to the Google Sheet node, Is it always going to be one item you are working with from that Set node?

When the workflow fails to run is there more to the error in the output?

Correct - the Google Sheet node always uses one item from the Set node.

Here’s a video that demonstrates a bit more detail: Dropbox - - Simplify your life

You’ll see that the workflow breaks when I delete the Set node - although the same values live in a prior node and display in the left sidebar, the data does not come through when I use those json expressions in my code.

Is that only an issue in the UI or does it actually also fail when you execute the workflow in production or when you press the “Execute Workflow” button?

Great catch. Sometimes that is the case (I was able to remove the ‘Reset Values - Ready to Create’ and ‘Reset Values’ nodes near the top without disrupting my workflow).

However, I tried doing the same with the ‘Reset Values - Notes Given’ node, which resulted in failed executions:

It seems a bit unpredictable when ‘can’t get data for expression’ will/will not result in a failed execution, but perhaps there’s a rhyme or reason I’m not seeing.

Appreciate the support!

@billybjork , I have come across this error as well after the upgrade from v0 to v1 (it was $node() back then I think). The way I solved it (at least I hope I did and it is not just a transient success) is by replacing $('NODE').item.json with $('NODE').first().json. Though, the ‘NODE’ in my case always has only one item (not sure if that is applicable to your workflow).

Hopefully it helps.

1 Like

What @ihortom wrote will work fine if you only have a single item.

Why it could potentially work in production but not while developing has to do with how hard it is to sometimes figure out which nodes should run and it so causes “strange” issues. Anyway, I did not expect it to be an issue here, but is helpful as then you will get at least the full error message which is helpful to debug.

Can you please upgrade to the latest n8n version? I think there it could work. If I remember correctly was there an issue with the pairedItem functionality (which is the problem here) on the Google Sheet node which we fixed recently.

Thank you both for the support.

I upgraded to the latest n8n version and unfortunately that didn’t resolve the issue.

I also tried changing the syntax as @ihortom suggested, and it prevented the error but returned blank values in the execution.

For now I’ll continue with the Set nodes as needed - not a big issue. Very happy user of n8n aside from that.

@billybjork , is the NODE in your reference the Switch node? Then the expression I gave you will not work as you need to extend that expression with the reference to the actual output of Switch. When I suggested to use $('NODE').first().json I assumed you would reference the node with a singe output like Set, for example. If you want to reference Switch node then you could try something like $('NODE').first(2).json (here “2” represents the index of the 3rd output).


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.