After updating to version 1.53.2, I started experiencing issues with the AI AGENT - Tools Agent node when using Anthropic as the LLM. I noticed that the error occurs when I use memory together with tools. However, when I use either memory or tools separately, the error does not happen. The error returned is as follows:
Stack trace
TypeError: Cannot read properties of undefined (reading ‘map’) at _formatContent (/usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/chat_models.cjs:281:39) at /usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/chat_models.cjs:403:26 at Array.map () at _formatMessagesForAnthropic (/usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/chat_models.cjs:351:52) at ChatAnthropic._streamResponseChunks (/usr/local/lib/node_modules/n8n/node_modules/@langchain/anthropic/dist/chat_models.cjs:765:35) at _streamResponseChunks.next () at ChatAnthropic._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/language_models/chat_models.cjs:93:34) at ChatAnthropic.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:394:9) at RunnableBinding.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:840:9) at ToolCallingAgentOutputParser.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:383:26) at RunnableSequence._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:1208:30) at RunnableSequence.transform (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:394:9) at wrapInputForTracing (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:267:30) at pipeGeneratorWithSetup (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/utils/stream.cjs:245:19) at RunnableLambda._transformStreamWithConfig (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:288:26) at RunnableSequence._streamIterator (/usr/local/lib/node_modules/n8n/node_modules/@langchain/core/dist/runnables/base.cjs:1208:30)
Information on your n8n setup
- **n8n version:**1.53.2
- **Database (default: SQLite):**default
- **n8n EXECUTIONS_PROCESS setting (default: own, main):**default
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**n8n cloud
- **Operating system:**Windows 11