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.
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.
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.
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?
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.
@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).
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.
@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).