## Describe the problem/error/question
When calling a sub-workflow containing a …Wait (Webhook) node, the return data is incorrect:
- When called as Agent Tool: Returns data from node before Wait
- When called as Workflow: Returns initial input data
- Expected: Should return data from last node after webhook completion
## Steps to Reproduce
1. Create sub-workflow with:
- Initial API call
- Wait (Webhook) node
- Final data processing
2. Call this sub-workflow from main workflow
3. Wait for webhook completion
4. Check returned data in main workflow
## Current Behavior
- When called as Agent Tool: Returns data from the node before the Wait node
- When called as Workflow: Returns only the initial input data
- Webhook executes successfully but final data is not returned
## Expected Behavior
Should return the processed data from the last node after webhook completion
## Technical Details
- Using Wait node in 'Webhook' mode
- Webhook successfully triggers and completes
- Sub-workflow executes completely
- Issue occurs in data return to parent workflow
## What is the error message (if any)?
## Please share your workflow/screenshots/recording



```
Sub workflow :
{
"nodes": [
{
"parameters": {
"resume": "webhook",
"httpMethod": "POST",
"responseMode": "lastNode",
"limitWaitTime": true,
"resumeAmount": 10,
"resumeUnit": "minutes",
"options": {}
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
400,
0
],
"id": "ff89d4fa-5c3b-48ba-81cb-abb6554445ac",
"name": "Wait response",
"webhookId": "7e72cb0f-e29c-4e74-9509-95cc75e8e836"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "e2347a4a-cc19-4049-8a19-e11a411b648d",
"name": "test",
"value": "={{ \n /(x|twitter)\\.com.*?status/.test($json.url) ? {\n scraping_type: \"x post (ex-twitter)\",\n dataset_id: \"gd_lwxkxvnf1cynvib9co\"\n } : \n /linkedin\\.com\\/posts/.test($json.url) ? {\n scraping_type: \"linkedin post\", \n dataset_id: \"gd_lyy3tktm25m4avu764\"\n } : null\n}}",
"type": "object"
}
]
},
"includeOtherFields": true,
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-140,
0
],
"id": "bd71d82e-1b4e-4b52-b066-e3bf801331c4",
"name": "Set variable based on social network"
},
{
"parameters": {
"method": "POST",
"url": "https://api.brightdata.com/datasets/v3/trigger",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "dataset_id",
"value": "={{ $json.test.dataset_id }}"
},
{
"name": "include_errors",
"value": "true"
},
{
"name": "endpoint",
"value": "={{ $execution.resumeUrl }}"
},
{
"name": "format",
"value": "json"
},
{
"name": "uncompressed_webhook",
"value": "true"
},
{
"name": "force_deliver",
"value": "true"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "=[\n {\n \"url\": \"{{ $json.url }}\"\n }\n]",
"options": {
"response": {
"response": {
"fullResponse": true,
"neverError": true
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
180,
0
],
"id": "070df48f-adb7-4f8e-8c36-855a45f283c0",
"name": "Scrap special dataset post1",
"alwaysOutputData": true
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "2b1c7ff8-06a7-448b-99b7-5ede4b2e0bf0",
"name": "response",
"value": "={{ $json }}",
"type": "object"
}
]
},
"options": {}
},
"id": "ed06fc70-12fe-4d96-a135-8f20b3a6f566",
"name": "Set response",
"type": "n8n-nodes-base.set",
"typeVersion": 3.3,
"position": [
880,
0
]
},
{
"parameters": {
"mode": "raw",
"jsonOutput": "={\n \"scraping_type\": \"{{ $('Set variable based on social network').first().json.test.scraping_type }}\",\n \"username\": \"{{ $json.body[0].name || $json.body[0].headline }} \",\n \"description\":{{ JSON.stringify($json.body[0].description?.replaceAll('\"',\"'\")) || JSON.stringify($json.body[0].post_text?.replaceAll('\"',\"'\"))}}\n}\n ",
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
640,
0
],
"id": "21d7a234-7542-41be-b8cd-9d2f2dbee24a",
"name": "Prepare Response"
},
{
"parameters": {
"inputSource": "passthrough"
},
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [
-440,
0
],
"id": "63ec4196-1b1b-4dd0-af8f-4110abb6f833",
"name": "When Executed by Another Workflow"
}
],
"connections": {
"Wait response": {
"main": [
[
{
"node": "Prepare Response",
"type": "main",
"index": 0
}
]
]
},
"Set variable based on social network": {
"main": [
[
{
"node": "Scrap special dataset post1",
"type": "main",
"index": 0
}
]
]
},
"Scrap special dataset post1": {
"main": [
[
{
"node": "Wait response",
"type": "main",
"index": 0
}
]
]
},
"Set response": {
"main": [
[]
]
},
"Prepare Response": {
"main": [
[
{
"node": "Set response",
"type": "main",
"index": 0
}
]
]
},
"When Executed by Another Workflow": {
"main": [
[
{
"node": "Set variable based on social network",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {
"When Executed by Another Workflow": [
{
"url": "https://x.com/tom_doerr/status/1887628241587827097"
}
]
},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "8e95de061dd3893a50b8b4c150c8084a7848fb1df63f53533941b7c91a8ab996"
}
}
```
## Share the output returned by the last node
Parent Workflow :
```
[
{
"url": "https://x.com/tom_doerr/status/1887628241587827097"
}
]
```
Sub-workflow :
```
[
{
"response": {
"scraping_type": "x post (ex-twitter)",
"username": "Tom Dörr ",
"description": "Build AI agents with MCP"
}
}
]
```
## Debug info
### core
- n8nVersion: 1.77.3
- platform: docker (cloud)
- nodeJsVersion: 20.18.2
- database: sqlite
- executionMode: regular
- concurrency: 20
- license: community
### storage
- success: all
- error: all
- progress: false
- manual: true
- binaryMode: filesystem
### pruning
- enabled: true
- maxAge: 720 hours
- maxCount: 25000 executions
### client
- userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/132.0.0.0 safari/537.36
- isTouchDevice: false
Generated at: 2025-02-07T17:56:34.150Z}