I’m building an AI automation workflow with n8n using the HAL 9001 agent node (from LangChain). The workflow receives a Telegram message, processes it, and passes it to the agent for delegation to sub-agents.
However, I’m encountering the following error:
Cannot read properties of undefined (reading ‘content’)
Workflow Overview:
- Input: Telegram message → Switch (handles text/audio/image)
- Set Message: Assigns
userMessage
,modal
, andsessionId
- HAL 9001 Agent: Processes the input and delegates to supervisors (Productivity, Communication, etc.)
Error Details:
- The error occurs in the HAL 9001 node.
- The input to the agent is:
{
“userMessage”: “Hii”,
“modal”: “text”,
“sessionId”: “1761264379”
}
What I’ve Tried:
- Checked the input data—confirmed
userMessage
exists but notcontent
. - Looked at the HAL 9001 node’s system message, which includes:
{{ $json?.text || $json?.content || $json?.body?.message || $json?.message?.text || “” }}
- Tried modifying the system message to include
userMessage
, but the error persists.
Questions:
- Should I modify the input to include a
content
field? - Or should I adjust the HAL 9001 node’s prompt to use
userMessage
instead? - Has anyone else faced this issue with the LangChain agent nodes?