All guides

n8n label routing: Switch fallbacks and multiple outputs

Route AI labels to branches, catch unknown values explicitly, and check whether an item reaches multiple outputs.

AINavWritten / Updated Sources checked
On this page

At a glance

The goal is to route an upstream classification result to an explicit branch. You need access to a workflow editor and an existing label field. Synthetic data illustrates the configuration; node behavior comes from the official Switch page. n8n and a classification model were not run.

Input, configuration and output checks

  1. Prepare input

    Define identifiers, fields and the intended output before configuration.

  2. Inspect settings

    Inspect the documented operation and its relevant options.

  3. Verify and stop

    Inspect identifiers and results before downstream processing; stop when the contract is unclear.

Documentation and local fixtures are separate from product execution.

Prepare labels and an unknown value

Prepare three synthetic items with label values question, feedback and other, each with a separate id. These are input fixtures, not model results. The docs describe Switch as similar to If but with multiple output routes; it does not generate labels. Check the actual upstream field name and type before defining rules, or missing fields may become confused with unknown categories.

Use Rules for exact matches

Choose Rules mode and add one String is equal to rule for question and one for feedback. Add Routing Rule creates another branch, and Rename Output gives it a readable name. Check Ignore Case and Less Strict Type Validation: the former controls case comparison and the latter allows attempted type conversion. The exercise expects fixed lowercase strings and does not rely on implicit conversion; actual settings should match the upstream contract.

Give unknown values a separate exit

Fallback Output defaults to None, which ignores unmatched items. Extra Output routes them to an additional output, while Output 0 mixes them with the first rule. This exercise selects Extra Output and sends other for manual inspection; that is an exercise choice, not an official recommendation. Before adoption, add an unseen category and an item with no label and inspect their actual destinations so that no match is not mistaken for everything processed.

Check first-match and all-match routing

With Send data to all matching outputs enabled, one item can reach every matching output; otherwise it reaches the first match. For mutually exclusive labels, check for overlapping rules and count outputs per id. Only an exact-match fixture was modeled locally; n8n missing-field, conversion and case behavior were not verified. If counts or unknown-value destinations violate the contract, stop downstream writes, inspect the options and recheck in a disposable workflow.

Article sources

Original editorial content; official descriptions and checking suggestions are distinguished.

  1. n8n · Official sources
    View details