Switch note wirh "Continue on error" not working as expected

Describe the problem/error/question

Hi,
I configured a Switch node to match the value of an incoming json.
The node works if configured to Stop in case of errors.
If I chose the option to continue with error output, the node works only if there’s only one routing rule.
If I try to introduce more rules the execution stops on the node, even if one rule has match with incoming data.
Maybe I’m missing something?

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

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

Can you please add a ``` above and below your code?
That will the workflow embedded

```
put code here like this
```

Sorry for the delay, I just got a change to look at this and you’re right. Switch isn’t working as expected when set to continue on error is enabled.

I will forward this to the n8n team so they can look into it.

Thank you
regards

Let me ask, what could the possible failure in this node be? Why do you need continue with error option?

Only thing that could happen would be the json is empty so no options get picked. In that case you could set a “Fallback Output” in the Options in the switch node. Then it gives an extra output like the error incase nothing matches.

The only way you would have an error is if you are performing a method on an empty json value which you aren’t doing in your node

Hi Liam, thanks for your answer…

I wanted to use the option “continue with error output” is, indeed, to try to intercept all the possible failures of the node, besides those that I can prevent and manage (feel free to correct me or suggest a better way, I’m discovering n8n and I’m missing something for sure).

regards
Antonio

There is a built in option for cases that don’t match

It’s under the more options on the bottom of the switch main node page. It’s “Fallback Output”. Enable it and you can set whether it uses an existing branch or a dedicated one

1 Like

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