-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Summary
The auto-sanitization system incorrectly classifies empty, notEmpty, exists, and notExists operations on object type as binary operators, stripping the required singleValue: true property. This silently breaks IF nodes that check whether an object is empty/non-empty or exists, causing them to error on execution.
Steps to reproduce
-
Create a workflow with an IF node using an
object/emptyoperator:{ "operator": { "type": "object", "operation": "empty", "singleValue": true } } -
Make any unrelated change to the workflow via
n8n_update_partial_workflow(e.g. rename a different node, update a connection, change settings). -
Observe that the IF node's operator has been modified to:
{ "operator": { "type": "object", "operation": "empty" } } -
Execute the workflow. The IF node now fails with:
Wrong type: '' is a string but was expecting an object
Expected behavior
singleValue: true should be preserved (or added) for all object type operators, since they are all unary and do not take a right-hand value.
Actual behavior
-
n8n_update_partial_workflow: Silently stripssingleValue: truefrom ALLobjectoperators in the workflow, not just modified nodes. -
n8n_update_full_workflow: Rejects the entire update with an explicit error:binary operator "empty" should not have "singleValue: true". Only unary operators (isEmpty, isNotEmpty, true, false, isNumeric) need this property.
Root cause
isUnaryOperator() in node-sanitizer.ts and the unary list in validateOperatorStructure() in n8n-validation.ts only recognize isEmpty, isNotEmpty, true, false, isNumeric.
The object data type uses different operation names (empty, notEmpty, exists, notExists) which are all unary but missing from these lists. Per n8n source (packages/frontend/editor-ui/src/features/ndv/parameters/components/FilterConditions/constants.ts), all 4 object operators have singleValue: true.
Workaround
Use the n8n REST API directly via HTTP (bypassing the MCP tool) for workflow write operations.
Environment
- n8n-mcp version: 2.35.2
- n8n IF node typeVersion: 2.2 and 2.3