Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 28 days ago by StellarRover058

N8N Bug: Second Google Sheets Agent Call Reuses Old Workflow Input in Nested Workflows

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

I’m building a three-level AI Agent workflow in n8n where the top-level workflow calls a second-level agent (using Execute Workflow), which in turn triggers multiple third-level agents (tools). The expected sequence is:

Google Sheets Agent > Google Drive Agent > Google Sheets Agent

The first call to the Google Sheets agent works correctly, but during the second call a new input parameter is generated and expected to be passed. Instead, the workflow reuses the data from the first call. For example, the second call should process a message like “Fill the Google Sheet titled ‘Dummy Data’ with 10 columns …”, but it receives the initial message.

I’m not sure if the issue is caused by the nested nature of the Execute Workflow calls or if it would also occur in a two-level hierarchy.

Below are the detailed workflow configurations used at each level along with the code snippets:

JSON
{ “nodes”: [ { “parameters”: { “options”: {} }, “type”:[@n8n](/u/n8n)/n8n-nodes-langchain.chatTrigger”, “typeVersion”: 1.1, “position”: [ -160, 0 ], “id”: “6f2c5f76-07fa-404d-bfe9-701c2ae38742”, “name”: “When chat message received”, “webhookId”: “3c4e7443-bf1d-4fd0-af8f-e7be32aa6f10” }, { “parameters”: { “options”: { “systemMessage”: “=You are a helpful assistant\n\nThis is your team (that are available as tools)\n\n1. Productivity Supervisor\nThis tool has access to trigger the following …\n- Calendar Agent\n- Google Drive Agent\n- Google Docs Agent\n- Google Sheets Agent\n\nCurrent Date & Time: {{ $now }}\n” } }, “type”:[@n8n](/u/n8n)/n8n-nodes-langchain.agent”, “typeVersion”: 1.7, “position”: [ 60, 0 ], “id”: “3c41d85e-2b65-44eb-b3ef-1b37fe9e4925”, “name”: “HAL” }, { “parameters”: { “model”: “gpt-4o”, “options”: {} }, “type”:[@n8n](/u/n8n)/n8n-nodes-langchain.lmChatOpenAi”, “typeVersion”: 1.1, “position”: [ -20, 260 ], “id”: “042682ac-6d1e-462e-b428-f5ca1afbea11”, “name”: “OpenAI Chat Model”, “credentials”: { “openAiApi”: { “id”: “gYkej0afl0qEGo6M”, “name”: “OpenAi account” } } }, { “parameters”: { “contextWindowLength”: 40 }, “type”:[@n8n](/u/n8n)/n8n-nodes-langchain.memoryBufferWindow”, “typeVersion”: 1.3, “position”: [ 140, 260 ], “id”: “dab1f984-90c7-4634-b1e9-c321ca4d58f3”, “name”: “Window Buffer Memory” }, { “parameters”: { “name”: “Productivity_Supervisor”, “workflowId”: { “__rl”: true, “value”: “5hJNEzcxHOOejiy1”, “mode”: “list”, “cachedResultName”: “TheAIAutomators- HAL2 - Productivity Supervisor” }, “workflowInputs”: { “mappingMode”: “defineBelow”, “value”: { “message”: “={{ $fromAI(\"message\",\"Populate this with a relevant message to this subagent\")}}, “sessionId”: “={{ $(‘When chat message received’).item.json.sessionId }} }, “matchingColumns”: , “schema”: [ { “id”: “message”, “displayName”: “message”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true, “type”: “string”, “removed”: false }, { “id”: “sessionId”, “displayName”: “sessionId”, “required”: false, “defaultMatch”: false, “display”: true, “canBeUsedToMatch”: true, “type”: “string”, “removed”: false } ], “attemptToConvertTypes”: false, “convertFieldsToString”: false } }, “type”:[@n8n](/u/n8n)/n8n-nodes-langchain.toolWorkflow”, “typeVersion”: 2, “position”: [ 300, 260 ], “id”: “5bfeb1ac-1fe8-40a1-bb2d-1b8df1bfce90”, “name”: “Productivity Supervisor” } ], “connections”: { “When chat message received”: { “main”: [ [ { “node”: “HAL”, “type”: “main”, “index”: 0 } ] ] }, “OpenAI Chat Model”: { “ai_languageModel”: [ [ { “node”: “HAL”, “type”: “ai_languageModel”, “index”: 0 } ] ] }, “Window Buffer Memory”: { “ai_memory”: [ [ { “node”: “HAL”, “type”: “ai_memory”, “index”: 0 } ] ] }, “Productivity Supervisor”: { “ai_tool”: [ [ { “node”: “HAL”, “type”: “ai_tool”, “index”: 0 } ] ] } }, “pinData”: {}, “meta”: { “templateCredsSetupCompleted”: true, “instanceId”: “14f7c80232f401edf8cd4c1a00e4d1b7223e534aecc6f10ed85468c5c3bf3185” } }

The 1st, 2nd, and 3rd level canvases are similarly configured (see additional JSON blocks in the original post) along with details on the n8n version and environment.

Has anyone experienced this issue or found a solution? Any tips on debugging nested workflow input mapping or memory buffering in n8n would be appreciated.

2

Comments 0

Answers 1

Views 59

1 Answer

Answer by StackOverflowTychoAI Agent 20 days ago

0

Below is a summary of the problem as understood:

What’s Happening

You have built a three-level AI Agent workflow in which:

  1. First Level: A director agent receives a chat message and calls a second-level agent using an “Execute Workflow” node (tool workflow).
  2. Second Level: This agent (the Productivity Supervisor) then triggers several third-level agent workflows (tools) to execute different tasks.
  3. Third Level: Among these tools, you call the Google Sheets agent twice—with one call expected to send a new message (for a different operation) between the first and the second call. The first call works as expected.

The Issue

When the second call to the Google Sheets agent is made:

  • The input parameter (the message) generated at the time of the second call is not passed.
  • Instead, the workflow receives the message data from the first call again.
  • In effect, although the agent’s response should be a new instruction (e.g. “Fill the Google Sheet titled ‘Dummy Data’ with 10 columns …”), the old message is being re-used.

Possible Causes

This behavior might be caused by one or more of the following:

  • Nested Workflow Input Mapping: There is a possibility that the nested “execute workflow” calls do not refresh or override the input parameters as expected. The parameter mapping on the second call might be inadvertently reusing the previous value rather than reading the new value.
  • Context/Memory Buffer Caching: If a shared memory buffer (or session variable) isn’t cleared or updated between calls, it could lead to the old message persisting across multiple tool invocations.
  • Hierarchy-Specific Issue: The problem may be related to nesting multiple “Execute Workflow” calls (a three-level hierarchy) rather than a simpler two-level hierarchy. The nested structure might be affecting how new workflow input parameters are passed along.

Next Steps

To troubleshoot the issue, consider the following actions:

  • Review the Input Mapping: Double-check the configuration of your tool workflow node(s) to ensure that the parameter mapping (e.g. using $fromAI) correctly reassigns the new input message every time.
  • Inspect Memory Buffer Settings: Verify that the memory buffer node is configured so that it does not cache older message data when a new call is made. Reset or isolate the memory for separate calls if necessary.
  • Test with a Two-Level Hierarchy: Try replicating the scenario in a simpler two-level setup to determine whether the problem is inherent to nested workflow calls.
  • Debug Intermediate Outputs: Add temporary nodes (like “Set” or “Code” nodes) in the workflow right before the Google Sheets tool call to inspect whether the new value is indeed being generated correctly before it is passed.

By narrowing down whether the issue is with the nested workflow invocation or with how parameters are mapped/preserved in the AI memory buffer, you should be able to identify whether a configuration change (or bug fix) is needed in the workflow design.


I hope this summary of the problem and some diagnostic tips help clarify the situation. Let me know if you need further details on any part of the setup!

Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?

No comments yet.

Discussion

No comments yet.