Describe the problem/error/question
Hello I’m getting **“**Cannot read properties of undefined (reading ‘pop’)” error when triggering subworkflow from main workflow using MCP trigger. This error is returned in the main workflow execution, where there is no execution logs and the MCP server trigger is marked deactivated after execution, but the subworkflow is successfully executed without error.
What is the error message (if any)?
Workflow execution had an error
Cannot read properties of undefined (reading ‘pop’)
Please share your workflow
Main workflow:
{
“nodes”: [
{
“parameters”: {
“path”: “scaffolding-test1”
},
“type”: “ @n8n/n8n-nodes-langchain.mcpTrigger”,
“typeVersion”: 2,
“position”: [
-352,
-320
],
“id”: “f888e18e-5142-4724-b234-0000d6a4a885”,
“name”: “MCP Server Trigger”,
“webhookId”: “c606ed06-30ba-49dd-a2c4-02aa4f69aaca”,
“alwaysOutputData”: true,
“retryOnFail”: false,
“notesInFlow”: true,
“disabled”: true
},
{
“parameters”: {
“model”: {
“_rl": true,
“value”: “gpt-4o”,
“mode”: “list”,
“cachedResultName”: “gpt-4o”
},
“options”: {
“temperature”: 0.1,
“maxRetries”: 2
}
},
“type”: “ @n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
-304,
304
],
“id”: “151f0379-7209-4414-86c5-7cb2598d1286”,
“name”: “OpenAI Chat Model”,
“credentials”: {
“openAiApi”: {
“id”: “nfpQx50TY0x3sZLJ”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “scaffolding”
},
“type”: “ @n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
-160,
304
],
“id”: “ef515a41-d2d6-4a35-bf88-346551a4293f”,
“name”: “Simple Memory”
},
{
“parameters”: {
“toolDescription”: “AI Agent that executes plan and calls other tools”,
“text”: "={{ /n8n-auto-generated-fromAI-override/ $fromAI('Prompt__User_Message’, , 'string') }}", "options": { "systemMessage": "You are an MCP Tool Execution Agent designed to execute complex multi-step plans through careful, sequential execution.\n\n## Core Instructions\n\n1. **Sequential Execution Only**: Execute the provided plan step by step in the exact order specified. Never skip steps or execute them out of order.\n\n2. **Human-in-the-Loop Required**: After completing each step, you MUST:\n - Report what you accomplished in that step\n - Show any relevant outputs or results\n - Wait for explicit human confirmation before proceeding to the next step\n - Ask \"Ready to proceed to the next step?\" or similar confirmation\n\n3. **Step Completion Verification**: Before moving to the next step, ensure:\n - The current step is fully completed\n - Any expected outputs are generated\n - No errors occurred that would affect subsequent steps\n\n4. **Error Handling**: If a step fails:\n - Stop execution immediately\n - Report the error clearly\n - Ask the human how to proceed (retry, skip, or abort)\n - Do not attempt to continue without human guidance\n\n5. **Plan Adherence**: \n - Follow the execution plan exactly as provided\n - Do not add, remove, or modify steps without explicit human approval\n - If clarification is needed for a step, ask the human before proceeding\n\n6. **Communication Style**:\n - Be clear and concise about what you're doing\n - Report both successes and failures\n - Always wait for human input before continuing\n\n## Example Flow\nStep 1: [Execute first step]\nResult: [Report outcome]\nReady to proceed to step 2? (Wait for human response)\n\nStep 2: [Execute second step]\nResult: [Report outcome] \nReady to proceed to step 3? (Wait for human response)\n\nRemember: Your role is careful, controlled execution with human oversight at every stage.", "returnIntermediateSteps": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_Intermediate_Steps', , ‘boolean’) }}”,
“batching”: {
“batchSize”: 3
}
}
},
“type”: “ @n8n/n8n-nodes-langchain.agentTool”,
“typeVersion”: 2.2,
“position”: [
-272,
-112
],
“id”: “7a31c9f6-3801-4836-b1b5-8c3d5cc03452”,
“name”: “Tool Execution Subagent”
},
{
“parameters”: {
“description”: “Call this tool when asking for approval via Slack.”,
“workflowId”: {
“__rl”: true,
“value”: “7uVNqHNxfzSv3mfM”,
“mode”: “list”,
“cachedResultName”: “slack_approval_workflow”
},
“workflowInputs”: {
“mappingMode”: “defineBelow”,
“value”: {
“user”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘user’, Slack username of recipient, ‘string’) }}”,
“body”: “={{ /n8n-auto-generated-fromAI-override/ $fromAI(‘body’, Slack message body to send, ‘string’) }}”
},
“matchingColumns”: ,
“schema”: [
{
“id”: “user”,
“displayName”: “user”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“canBeUsedToMatch”: true,
“type”: “string”,
“removed”: false
},
{
“id”: “body”,
“displayName”: “body”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“canBeUsedToMatch”: true,
“type”: “string”,
“removed”: false
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
}
},
“type”: “ @n8n/n8n-nodes-langchain.toolWorkflow”,
“typeVersion”: 2.2,
“position”: [
64,
-144
],
“id”: “5458b3e0-9dc0-4fd1-b201-db2afc469751”,
“name”: “Slack Approval Subworkflow”,
“notesInFlow”: false
}
],
“connections”: {
“OpenAI Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “Tool Execution Subagent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “Tool Execution Subagent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Tool Execution Subagent”: {
“ai_tool”: [
[
{
“node”: “MCP Server Trigger”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Slack Approval Subworkflow”: {
“ai_tool”: [
[
{
“node”: “Tool Execution Subagent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “ea6457c05242bdce53dba323db903f6ecd3cfbf855b6a7b550201432876dd801”
}
}
Subworkflow:
{
“nodes”: [
{
“parameters”: {
“operation”: “sendAndWait”,
“user”: {
“__rl”: true,
“value”: “={{ $json.user }}”,
“mode”: “username”
},
“message”: “={{ $json.body }}”,
“approvalOptions”: {
“values”: {
“approvalType”: “double”
}
},
“options”: {
“appendAttribution”: true
}
},
“type”: “n8n-nodes-base.slack”,
“typeVersion”: 2.3,
“position”: [
96,
0
],
“id”: “bee6b213-3a28-4042-bdd7-d9e8cf91ed6e”,
“name”: “Send message and wait for response”,
“webhookId”: “0870f0a3-bf75-42e7-932a-5c10d6796840”,
“retryOnFail”: false,
“notesInFlow”: false,
“alwaysOutputData”: true,
“credentials”: {
“slackApi”: {
“id”: “w0g4WqEYweUz1Nzq”,
“name”: “Slack account”
}
}
},
{
“parameters”: {
“workflowInputs”: {
“values”: [
{
“name”: “user”,
“type”: “any”
},
{
“name”: “body”,
“type”: “any”
}
]
}
},
“type”: “n8n-nodes-base.executeWorkflowTrigger”,
“typeVersion”: 1.1,
“position”: [
-144,
0
],
“id”: “fa110365-c541-4587-96cc-3ecd25e70d61”,
“name”: “When Executed by Another Workflow”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “f50a7c8c-1c4a-41c8-bb12-e187688b4bbe”,
“leftValue”: “={{ $json.data.approved }}”,
“rightValue”: “true”,
“operator”: {
“type”: “boolean”,
“operation”: “true”,
“singleValue”: true
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
320,
0
],
“id”: “e49a2d18-1726-46b1-82f7-371a97776edf”,
“name”: “If”
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “cf09c95c-f25e-4fd7-bade-a0feaeaffb3b”,
“name”: “message”,
“type”: “string”,
“value”: “=The message is approved on Slack. Proceed to next step!”
}
]
},
“options”: {}
},
“id”: “3623fbec-c487-4cd9-961e-dd688d528e3f”,
“name”: “Generate Approval Message”,
“type”: “n8n-nodes-base.set”,
“position”: [
640,
-80
],
“typeVersion”: 3.4
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “cf09c95c-f25e-4fd7-bade-a0feaeaffb3b”,
“name”: “message”,
“type”: “string”,
“value”: “=The message is declined on Slack. End the execution process.”
}
]
},
“options”: {}
},
“id”: “c88a30b3-ee14-490f-b4d2-bed843143dbf”,
“name”: “Generate Decline Message”,
“type”: “n8n-nodes-base.set”,
“position”: [
640,
96
],
“typeVersion”: 3.4
}
],
“connections”: {
“Send message and wait for response”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
}
]
]
},
“When Executed by Another Workflow”: {
“main”: [
[
{
“node”: “Send message and wait for response”,
“type”: “main”,
“index”: 0
}
]
]
},
“If”: {
“main”: [
[
{
“node”: “Generate Approval Message”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Generate Decline Message”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “ea6457c05242bdce53dba323db903f6ecd3cfbf855b6a7b550201432876dd801”
}
}
Share the output returned by the last node
No execution logs from main workflow.
Problem executing workflow
There was a problem executing the workflow.
Cannot read properties of undefined (reading ‘pop’)
Subworkflow output:
[ { "message": "The message is approved on Slack. Proceed to next step!" } ]
Information on your n8n setup
- n8n version: latest docker image
- Database (default: SQLite): default
- n8n EXECUTIONS_PROCESS setting (default: own, main): default
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: macOS
