n8n IF: troubleshooting data type mismatches
Check data types, conversions and empty values when an IF condition produces unexpected results.
The IF node splits incoming items into two outputs, true and false, one item at a time. It does not stop the workflow and it does not filter — every item goes somewhere.
The type mismatch
This is the cause of most IF problems, and it is invisible in the panel because
"5" and 5 look identical on screen.
A webhook delivers a JSON body where quantity is the string
"5". Your condition is Number → larger than → 3. n8n
validates the type strictly, finds a string where a number was declared, and the
comparison fails. Every item goes false.
{ "quantity": "5" }
// what you wrote
Number: {{ $json.quantity }} larger than 3
// the fix - cast it, do not hope
Number: {{ Number($json.quantity) }} larger than 3
There is a Convert types where required option that will coerce for you. It is useful for messy inbound data, but casting explicitly in the expression is better practice, because it makes the assumption visible to the next person reading the workflow.
Empty, null, and missing are three different things
A field that is an empty string, a field set to null, and a field that is not present at all will each behave differently depending on which operator you pick. Is empty, exists and is equal to "" are not interchangeable. When the source is an external API, assume all three cases occur and test them.
An unconnected branch is a decision
If the false output goes nowhere, items routed there stop. That is a legitimate way to filter — but it is silent, and someone reading the canvas later cannot tell whether you meant to discard those items or forgot to wire something.
Where the discard is intentional and the volume matters, send the false branch to a NoOp node named something like "Ignored: already synced". It costs nothing and it documents the intent on the canvas.
When to stop using IF
Two outcomes: IF. Three or more: Switch. Chaining three IF nodes to cover four cases works, but the canvas becomes a staircase, and adding a fifth case means rewiring rather than adding a row.
Building something where this matters?
Discuss a focused integration pilot covering the agreed workflow, error handling, testing and handover. Talk to our team about available new-client launch benefits.
