Bug? Start multiple Sub-Workflows asynchronously

Describe the problem/error/question

“Respond to Webhook” is reached as expected but it does not end its Webhook call. The Python client does not get a return code.

Sample run as Test Workflow:

Please share your workflow

{
“name”: “AutonomousAgentFork”,
“nodes”: [
{
“parameters”: {
“jsCode”: “const resultset = [\n {\n "type": "workflow",\n "label": "SWOT",\n "pitch": "Explains the workings of SWOT to the user",\n "prompt": "Explain why the sky is blue.",\n "model": "qwen2.5:14b"\n },\n {\n "type": "workflow",\n "label": "SOFT",\n "pitch": "validate an issue of the user according to the rules of the SOFT framework",\n "prompt": "Explain the priciples of SWOT.",\n "model": "qwen2.5:14b"\n }\n]\nreturn resultset”
},
“id”: “d862ce0d-69bb-435c-8cde-238557a9f2c8”,
“name”: “Code”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-900,
660
]
},
{
“parameters”: {
“options”: {}
},
“id”: “bbfb064f-9870-420b-9147-818e97ace361”,
“name”: “Loop Over Items”,
“type”: “n8n-nodes-base.splitInBatches”,
“typeVersion”: 3,
“position”: [
-540,
680
]
},
{
“parameters”: {
“respondWith”: “allIncomingItems”,
“options”: {}
},
“id”: “b2355924-5e07-43ac-ad6e-690e2d61546f”,
“name”: “Respond to Webhook”,
“type”: “n8n-nodes-base.respondToWebhook”,
“typeVersion”: 1.1,
“position”: [
420,
360
]
},
{
“parameters”: {
“method”: “POST”,
“url”: “http://127.0.0.1:5678/webhook/ollamacall”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “callbackurl”,
“value”: “={{ $execution.resumeUrl.replace(‘localhost’, ‘127.0.0.1’) }}”
}
]
},
“sendBody”: true,
“bodyParameters”: {
“parameters”: [
{
“name”: “prompt”,
“value”: “={{ $json.prompt }}”
},
{
“name”: “model”,
“value”: “={{ $json.model }}”
}
]
},
“options”: {}
},
“id”: “1807ff4d-4d96-4bbe-aba1-05502222339a”,
“name”: “HTTP Request”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-380,
880
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “f2c53234-7c3e-47be-ba4c-25500729a20d”,
“name”: “=finishedSet”,
“value”: “”,
“type”: “array”
}
]
},
“options”: {}
},
“id”: “fde93d50-dd05-43cc-9bc8-945f2c5ea3fb”,
“name”: “Edit Fields”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-380,
420
]
},
{
“parameters”: {
“resume”: “webhook”,
“httpMethod”: “POST”,
“responseMode”: “responseNode”,
“options”: {}
},
“id”: “2e4eec41-803f-4a8f-99f7-a31ca1fb854f”,
“name”: “Wait”,
“type”: “n8n-nodes-base.wait”,
“typeVersion”: 1.1,
“position”: [
120,
520
],
“webhookId”: “76ec044a-e009-4467-941c-1d12c52e4599”
},
{
“parameters”: {
“conditions”: {
“options”: {
“version”: 1,
“leftValue”: “”,
“caseSensitive”: true,
“typeValidation”: “strict”
},
“conditions”: [
{
“id”: “385c3149-3623-4dd2-9022-770c32f82421”,
“operator”: {
“type”: “number”,
“operation”: “gte”
},
“leftValue”: “={{ $json.finishedSet.length }}”,
“rightValue”: “={{ $(‘Code’).all().length }}”
}
],
“combinator”: “and”
},
“options”: {}
},
“id”: “4e1e12b4-cb5e-4ace-828b-dfd9860f294d”,
“name”: “If All Finished”,
“type”: “n8n-nodes-base.if”,
“position”: [
-120,
480
],
“typeVersion”: 2
},
{
“parameters”: {
“jsCode”: “let json = $(‘If All Finished’).first().json;\nif (!json.finishedSet) json.finishedSet = ;\nlet finishedItem = $(‘Wait’).item.json.body.result;\njson.finishedSet.push(finishedItem);\nreturn [json];”
},
“id”: “2ac23e12-dedb-4f1a-88cb-bf40a5a04a84”,
“name”: “Update finishedSet”,
“type”: “n8n-nodes-base.code”,
“position”: [
400,
620
],
“typeVersion”: 2
},
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “agentfork”,
“responseMode”: “responseNode”,
“options”: {}
},
“id”: “6446bfd8-7b58-4c36-be91-609167b32511”,
“name”: “Webhook”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 2,
“position”: [
-1140,
600
],
“webhookId”: “425eb907-463d-417d-ab6e-71b62e2a68ff”
}
],
“pinData”: {},
“connections”: {
“Code”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
},
“Loop Over Items”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTTP Request”: {
“main”: [
[
{
“node”: “Loop Over Items”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “If All Finished”,
“type”: “main”,
“index”: 0
}
]
]
},
“Wait”: {
“main”: [
[
{
“node”: “Update finishedSet”,
“type”: “main”,
“index”: 0
}
]
]
},
“If All Finished”: {
“main”: [
[
{
“node”: “Respond to Webhook”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Wait”,
“type”: “main”,
“index”: 0
}
]
]
},
“Update finishedSet”: {
“main”: [
[
{
“node”: “If All Finished”,
“type”: “main”,
“index”: 0
}
]
]
},
“Webhook”: {
“main”: [
[
{
“node”: “Code”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: true,
“settings”: {
“executionOrder”: “v1”,
“timezone”: “Europe/Berlin”,
“saveManualExecutions”: true,
“callerPolicy”: “workflowsFromSameOwner”
},
“versionId”: “8b6c8ff1-86c9-4285-9292-a90fcc1dc300”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “68f9e66783549a11e344292a1ef8ccb1a9d2307f134c3a15405499ae2f6cb69a”
},
“id”: “lYEkSxOsDcKqG4Ft”,
“tags”: [
{
“createdAt”: “2025-03-02T10:43:14.580Z”,
“updatedAt”: “2025-03-02T10:43:14.580Z”,
“id”: “AlTrjLLH9GXckgNI”,
“name”: “PlaygroundPrototype”
}
]
}

Share the output returned by the last node

A valid json as expected. The client is not notified.

Information on your n8n setup

  • n8n version: 1.64.3
  • Database default: SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via desktop app on localhost
  • Operating system: Windows 10

I have been playing around with the sub-workflow to get new insights. I have a gut feeling that the logic of the Wait node collides with the Respond to Webhook node. Mixing Webhooks and Http Requests might be too much for n8n.

Experimenting with a sub-workflow instead of a webhook results in an empty set. The wrapping workflow does not wait for the sub-workflow to finish.

My insight: N8N is not suitable for parallelisation. I am kind of disappointed.

1 Like

For those who want to know: Adding an MQTT server solved my problem. Claims that you can without should be taken with care.

n8n is perfectly suited for parallelisation. But yeah the best thing is to use a MQTT for example to keep it under control. I personally always use RabbitMQ as it has some nice native nodes to use :slight_smile:

And no if you have a webhook that is waiting for a reply you should not be doing too much within that flow as timeouts and such can happen.
That is also why you see a lot of APIs with an endpoint to start a report/export or whatever and then a seperate endpoint to actually get the data when it is finished running in the background.

1 Like

Yes mom. Thank you for letting me know after I solved the issue myself. I love your way of teaching me. Its is really a pleasure after wasting weeks of frustration with n8n.

Sorry that u were stuck on it. But no need to reply like that. Just wanted to give a bit more info.
I see you posted 2 days ago, so you got a pretty fast reply. That u solved it even faster is only good.

Rabbitmq node is broke wither rabbit mq version 4.1.0 ma and other ussers keep getting , ’
read ECONNRESET ’ when trying to add cordentials

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.