I’m running into a strange issue with the AI Agent node.
I’m trying to wrap an incoming Facebook user message into a prompt for analysis. The message is received through a webhook and is located 13 steps before the AI Agent node where I want to use it.
This exact expression works perfectly in a different AI Agent node that is only 4 steps after the webhook. However, in the deeper node (13 steps later), I get undefined or an error like “Can’t determine which item to use.”
Dragging and dropping the Webhook1 node into the expression builder in that node also shows it can’t extract the data.
Why does this expression stop working in a later node, even though it’s identical and works fine earlier? Is there a limit to how far back you can reference another node? Or is this a bug?
Hi @Alexander_Rawa, it’s hard to figure out what’s going on without having a better view of your workflow. Maybe you could add your workflow JSON, or at least a screenshot of your workflow (but the JSON is better).
However, if you want to debug this yourself first, you could try to use .first()instead of .item in your expression. It could be that there’s a (or several?) nodes in between your agent and webhook that interfere with finding the correct paired item. If you need access to more than one item, there’s also the .all() method that gives you access to all items.
Hi Alexander, from what i can see, if the ai agent node is steps away from the incoming prompt node, and the expression works a few steps prior, it probably got lost in some other node, you can try looking through the output and input for each node one after the other to see where the data got missing.