Node executed, but no items were sent on 2nd branch of Switch node

Describe the problem/error/question

After my agent runs, it returns a boolean output to check the existence of data. With this output, I process two branches in the Switch node. Actually, I first used an If node but encountered the same issue, so I switched to the Switch node. If true, it processes A (code node); if false, it processes B (HTTP node). However, data from previous nodes is only transferred to the first branch, and the second branch is blank. If I switch the branch order, data is still only transferred to the first.

What is the error message (if any)?

No fields - node executed, but no items were sent on this branch

Please share your workflow

Share the output returned by the last node

Code node with data from previous ones

HTTP node with no data

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I’m thinking your agent output is still a string.
Try changing your Switch node conditions to String > is equal to and typing in true or false.
In javascript, a nonempty string is a true boolean, so it’ll return true every time.

Can you show us the results of Switch Node and AI Agent Node?

Here is the result of Agent node. As you can see, false/true is boolean type


Here is the Switch node if I change condition to string

Here is the result of Switch node in boolean condition

You actually don’t need switch node.
You can use If node again, and change the operator type to Boolean > is true or is false

If it helps, kindly mark my message as solution, thanks!

It doesn’t work, though. I also used the If node at first. And I tried again following your recommendation, but the result is the same with the Switch node.

Can you show us when you’re using If node?

Enough data at If node


After running, although the result is false, true branch contains enough data

While false branch contains nothing

I found a lot of people met the same issue as me. But not sure to resolve this. I cannot upgrade n8n because I use it in sandbox of my company

Kinda weird tho… I’m on debug rn

Hi @nnphuyen
Try this flow

Mine working fine with that cond

Thanks for your help but it still doesn’t work. Everything is fine with 1st branch, except 2nd ones :frowning:

It’s my limited knowledge, I will help you when I’m already

I can’t understand.
Can you just send the workflow?

And this really fine when you want to execute another different things from true and false condition. Nothing to aware with that.

I attached the workflow at first. You can scroll up and copy to your board. Thank you so much

Oh ok. Sorry.

By the way, it’s fine, nothing to aware with that. What your concern about btw?

As you can see, I have true/false branches to continue the next appropriate process. However, data is only sent to the first branch, and the second branch has nothing, so I don’t have data to continue the process. For now, I’m using a temporary solution by connecting the second process directly to the node before the Switch/If node to get the previous data.

What data you need from the previous node to continue the False condition process?

data from “data selection” node