Describe the problem/error/question
I am running a workflow that has a lot of data, so I’m using the loop node with an execute sub-workflow node to keep memory under control. I recently added another filter node to the sub-workflow and when that produced no output, I was surprised to see that the output of the sub-workflow had two branch outputs, the 2nd being the discarded data from the filter node, which then blew up my memory. I have worked around this with some extra logic in the sub-workflow, but the behavior surprised me.
Is this really the way people would want filter to work? I would expect to get no output, or an empty object if I set the ‘always produce output’ option, which is what I am using.
If this was an if node, then it would make sense that a dangling else output would make another branch, but not a filter node.
What is the error message (if any)?
No error
Please share your workflow
This is not the real flow, but shows the issue.
Main workflow:
{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"id": "6ad9f445-fea3-4ea1-8a5e-6554ea1d1489",
"name": "When clicking ‘Execute workflow’"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
220,
0
],
"id": "571c878d-e088-4a8d-91af-d7570a338316",
"name": "Loop Over Items"
},
{
"parameters": {
"workflowId": {
"__rl": true,
"value": "HIyrZja4jAgdPem2",
"mode": "list",
"cachedResultName": "Test sub-workflow"
},
"workflowInputs": {
"mappingMode": "defineBelow",
"value": {},
"matchingColumns": [],
"schema": [],
"attemptToConvertTypes": false,
"convertFieldsToString": true
},
"options": {}
},
"type": "n8n-nodes-base.executeWorkflow",
"typeVersion": 1.2,
"position": [
440,
0
],
"id": "b3c53c41-50a5-4c90-ae98-5c650b8d3b3a",
"name": "Execute Workflow"
}
],
"connections": {
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Execute Workflow",
"type": "main",
"index": 0
}
]
]
},
"Execute Workflow": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {
"When clicking ‘Execute workflow’": [
{
"name": "First item",
"code": 1
},
{
"name": "Second item",
"code": 2
}
]
},
"meta": {
"instanceId": "ad9cf2e17ebbbded2408dd876a4325e6ed035be4cece49d385a5040ddb1a5a1c"
}
}
Sub-workflow:
{
"nodes": [
{
"parameters": {
"inputSource": "passthrough"
},
"id": "c055762a-8fe7-4141-a639-df2372f30060",
"typeVersion": 1.1,
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
260,
340
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "e3ce0519-b944-4c77-9a06-fe591b64319b",
"leftValue": "={{ $json.name }}",
"rightValue": "Not there",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.filter",
"typeVersion": 2.2,
"position": [
480,
340
],
"id": "a9afe372-170e-4182-946b-3b4f2467b9ac",
"name": "Filter",
"alwaysOutputData": true
}
],
"connections": {
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"instanceId": "ad9cf2e17ebbbded2408dd876a4325e6ed035be4cece49d385a5040ddb1a5a1c"
}
}
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.97.1
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
- Operating system: