Error with OpenAI + AI Agent saying missing "id" field

Describe the problem/error/question

I’m using the AI Agent node to connect to the OpenAI provider, which is connected my LiteLLM instance which has ~50 models. Since LiteLLM follows the OpenAI spec, this works! And specifically, i’m using the Anthropic Claude 4 Sonnet mode. Running normal “chats” works fine. But it starts throwing the below error when I add my first tool. The postgres database connection is working. The error seems to be after the tool call on the second LLM call.

What is the error message (if any)?

This is the error message:

and the full stack trace (in case its helpful)

NodeOperationError: All OpenAI tool calls must have an "id" field. at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+n8n-nodes-langchain@file+packages+@n8n+nodes-langchain_eb368da7bd7c4c6a508e6e0c8f7eca22/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V2/execute.ts:180:12 at Array.forEach (<anonymous>) at ExecuteContext.toolsAgentExecute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+n8n-nodes-langchain@file+packages+@n8n+nodes-langchain_eb368da7bd7c4c6a508e6e0c8f7eca22/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V2/execute.ts:169:16) at processTicksAndRejections (node:internal/process/task_queues:105:5) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@n8n+n8n-nodes-langchain@file+packages+@n8n+nodes-langchain_eb368da7bd7c4c6a508e6e0c8f7eca22/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/V2/AgentV2.node.ts:190:10) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]_/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1194:9) at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]_/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1564:27 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@[email protected][email protected][email protected][email protected]_/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2135:11

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • **n8n version: 1.101.3
  • **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

hey @jweisman11 can you embed your workflow so we can understand problem better?

hi @moosa absolutely. Embedded my workflow below.

works fine on my side:


why don’t you try changing model I used gpt-4.1-nano

Dear @jweisman11 , the solution provided by @moosa is the perfect, I too think you should change the model of Chat_gpt or even if you like you can also use other LLM like deep seek or other…

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