When using a tool with the Tools agent (everything is using latest n8n and nodes) I get an error referencing previous nodes. Even when the node shows that the variable is green and correctly references the correct data, the workflow errors.
What is the error message (if any)?
connect “HTTP Request4” to “set_env1”
However they are clearly connected and the variable resolves correctly.
it may not work if you have mote than 1 item outputted via the AI tool. Because the syntax you were using can be rewritten to {{ $("set_env1").item.json["test_var"] }} (your version is a legacy syntax for this one) and it won’t work if the AI tool node (or any node in-between) have more than 1 items, while the set_env1 node has only 1 item, because it will raise an incompatibility issue ( items in these nodes can’t be linked due to the different amount)