// guides · n8n error index

n8n Switch node not working: missing items, wrong output and type errors, 30 runs

Fix the n8n Switch node: items silently dropped, only the first matching output used, "Wrong type: is a string but was expecting a number", "The ouput 2 is not allowed", null and empty values routed wrongly. 30 real runs on n8n 2.43.7.

Updated 2026-10-24 · about 10 minutes

Still stuck after these steps? Paste your exact n8n error and we'll reproduce it and email you the fix, free →

Steps

  1. Add a Fallback Output: unmatched items are dropped without a word

    With rules for paid and refunded, the item with status Paid (capital P, trailing space) matched nothing and simply disappeared. No error, no hint, and the execution showed success. In Options > Fallback Output, choose Extra Output (it showed up as a third output, index 2) or send it to an existing output. Then you can see what didn't match instead of losing it.

  2. Clean the value: whitespace beats case-insensitivity

    Turning off Case Sensitive on the rule, or the node option Ignore Case, did not help: Paid was still dropped, because of the trailing space. Normalise the left value instead: {{ $json.status.trim().toLowerCase() }} routed both paid and Paid correctly. Remember string rules are case-sensitive by default: fr did not equal FR.

  3. Fix "Wrong type: ... is a string but was expecting a number"

    Switch rules check types strictly. A Number rule on the text "120" stopped the whole run with Wrong type: '120' is a string but was expecting a number [condition 0, item 0]. The same happens with Boolean on the text "true" and with Date & Time on 24/10/2026 (only ISO dates like 2026-10-24 pass). Turn on Convert types where required on the rules (setting it in the node's options instead had no effect in our run), or convert in the value: {{ $json.amount.toNumber() }}, or {{ DateTime.fromFormat($json.date, 'dd/MM/yyyy') }} for dates. The error can also come from the right-hand value: {{ '100' }} there failed the same way.

  4. Loose mode still fails on one bad value

    With Convert types where required on, a single item with amount: "abc" stopped the run with Conversion error: the string 'abc' can't be converted to a number [condition 0, item 2]. The item number starts at 0, so item 2 is the third item. .toNumber() on the same value failed with only cannot convert to number, with no node name and no item index, which is harder to trace. Filter or fix bad values before the Switch, for example with a Filter node or {{ Number($json.amount) || 0 }}.

  5. Know that only the first matching output gets the item

    Rules total > 10 then total > 100: the item with 120 went only to output 0, and output 1 stayed empty although 120 > 100. That is the default. Turn on Options > Send data to all matching outputs and the item went to both. Otherwise, order your rules from the most specific to the most general.

  6. Watch null, missing and empty values

    An item with total: null was routed to the <= 100 output with no error, because null compares like 0. A rule status equals with an empty right value matched an empty string, null and a missing field alike: all 3 items. Use exists / does not exist or is empty rules when a missing value should go its own way; does not exist correctly caught the item with no country.

  7. Check every output is connected, and the value is an expression

    Items routed to an output with nothing attached vanished, and the run still showed success. A left value written as {{ $json.status }} in Fixed mode (no leading =) compared the literal text and sent 0 items to every output, again with no error. Switch the field to Expression. A Switch in Rules mode with no rules also outputs nothing, silently.

  8. In Expression mode, return a 0-based number

    Mode Expression worked with {{ $json.status === 'paid' ? 0 : $json.status === 'refunded' ? 2 : 1 }} and 3 outputs. Returning 2 with Number of Outputs set to 2 failed with The ouput 2 is not allowed. (the typo is n8n's), because outputs count from 0. Returning text such as paid failed with Invalid input for 'Output Index' [item 0]; the strings '0' and '1' were accepted.

What we ran

On 24 October 2026 we ran 30 executions on n8n 2.43.7 with n8n execute: a Manual Trigger, a Code node sending three items, the Switch node (version 3.2, one run on 3.1), and a No Op node on each output. Ana had status paid, amount "120", country FR; Bo had status Paid (capital and trailing space), amount "40", country fr, date 24/10/2026; Cy had status refunded, amount "abc", total null and no country.

SetupResult
Rules status equals paid / refunded, no fallbackAna on output 0, Cy on 1, Bo (Paid ) dropped silently; run shows success
Fallback Output: Extra OutputBo on a third output (index 2)
Fallback Output: Output 0Bo joins Ana on output 0
Rule Case Sensitive offBo still dropped (the trailing space is the problem)
Node option Ignore CaseBo still dropped
Left value {{ $json.status.trim().toLowerCase() }}Ana and Bo on 0, Cy on 1 (fixed)
Number > 100 on the string "120", strictWrong type: '120' is a string but was expecting a number [condition 0, item 0]
Same with Convert types where requiredConversion error: the string 'abc' can't be converted to a number [condition 0, item 2]; one bad item fails the run
Loose type validation set in node options instead of the ruleNo effect, same Wrong type error
{{ $json.amount.toNumber() }} with abcError cannot convert to number, no node name or item index
Number > 100 / <= 100, total nullNull item routed to <= 100, no error
Rules > 10 then > 100, default settings120 only on output 0; output 1 empty
Send data to all matching outputs on120 on both outputs
Boolean is true on the string "true"Wrong type: 'true' is a string but was expecting a boolean [condition 0, item 0]
country equals FR / country does not existFR on 0, missing on 1, fr dropped
Date & Time is after 2026-01-01 on 24/10/2026Wrong type: '24/10/2026' is a string but was expecting a dateTime [condition 0, item 1]
Array contains vip / Array is emptyBoth work as expected
String matches regex ^paid$Only the exact paid
Outputs 1 and 2 not connectedItems routed there vanish; run shows success
Expression mode, ternary returns 0, 1 or 2Works
Expression mode returns 2 with Number of Outputs 2The ouput 2 is not allowed. (sic): indexes start at 0
Expression mode returns the strings '0' / '1'Accepted
Expression mode returns $json.statusInvalid input for 'Output Index' [item 0]: expects a number but we got 'paid'
Left value {{ $json.status }} in Fixed mode0 items on every output, no error
Rules mode with no rules0 items, no error
Number >= with right value {{ '100' }}Wrong type error on the second value
One rule with OR (country FR or status refunded)Ana and Cy
status equals an empty valueMatches "", null and a missing field: all 3 items
Switch v3.1, same as the first runIdentical to v3.2

Quick checklist

Good to know

What we didn't test

FAQ

Why are items missing after my n8n Switch node?

They matched no rule, and by default unmatched items are dropped with no error. Add Options > Fallback Output (Extra Output) to catch them, then fix the rule, often a trailing space or a case difference.

Why does the n8n Switch node only send an item to one output?

By default an item goes to the first rule that matches. Turn on Options > Send data to all matching outputs to send it to every matching output.

What does 'Wrong type: is a string but was expecting a number' mean in n8n?

The rule compares numbers but the value is text, like "120". Turn on Convert types where required on the rules, or convert it with .toNumber(). Values that can't be converted, like 'abc', still fail.

What does 'The ouput 2 is not allowed' mean in n8n?

In Expression mode the Switch output index starts at 0. With 2 outputs, only 0 and 1 are valid; raise Number of Outputs or return a lower index.

Is the n8n Switch node case sensitive?

Yes, string rules are case-sensitive by default. You can turn that off per rule or with Ignore Case, but neither removes spaces, so trim and lowercase the value for reliable matches.

Related guides

New guides

Still stuck on your n8n error?

Paste the exact error and say what the workflow should do. We reproduce it on a real n8n install and email you the fix or a working workflow, usually within 24h. Free while we're in beta.

We'll only email you about your error and TaskToAgent.