Errors in First Workflow - Need Help - Urgent

Describe the problem/error/question

I am creating my first workflow. But getting errors "cannot read properties of null (reading ‘length’).. Seems the OpenAI chat model is providing the output, but the AI agent is seeing some errors. Not able to debug.. Tried various things such as different API keys.. but nothing seems to work.

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • **n8n version: 1.105.2
  • **Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): npm (mac)
  • **Operating system: Sequoia 15.5 MacOS
1 Like

Hi @Ranjitha

Its difficult to tell from your images. Copy this template from here into your n8n instance. Its set up be your first AI Agent. All workflows can be copied and pasted between instances.

Hope this helps!

:heart:If this response helped you, please click the heart to show that it is useful
:white_check_mark:If this response solved your issue, mark it as the solution to help the community

Thanks for the response @rbreen. I took the exact json file you provided, but still the same error. I am thinking something wrong with the environment or I am missing something. Here is the workflow I have.. Nothing fancy, just the basics. This is my first workflow and unfortunately I am stuck.

most probably you are out of credits.

Which credits? I am using the community edition (self hosted) of N8N. And I am getting responses from the gpt model. Do I need any other credits? I am new to N8N, so not sure.. I was told that we could use community edition for free? I am just starting to figure out. Thanks @moosa

sorry my bad i was refering to openai credits.
but you clearly have these.
I also ran same workflow and it ran smothly.

maybe try changing version of n8n?

also when i tried copy pasting your workflow it gave me this:

it did not recognized chat trigger node.

@moosa I think we are close.. what I found out was I have the latest N8N (1.105.2) and it’s creating the agent of typeVersion 2.2.. somehow this agent didnt work. My friend gave me typeVersion 1.8 (exact same code) and it worked. So not sure how I can change the agent version from N8N. Any solution for this? Or should I go back a version in N8N?

{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 2.2,
“position”: [
-32,
-48
],
“id”: “d352a32a-47d0-406a-8801-f270e1c411ca”,
“name”: “AI Agent”
},

Please suggest what version I should deploy, so that I wont step on any version related issues? Because I am starting to learn, would like to play with stable stuff. Thanks

1 Like

@Ranjitha

I’m on version 1.97.1 Try upgrading to that. Its an odd error.

maybe try switching to new stable version: [email protected]

In my case upgrading also doesn’t resolve the AI Agent node having that issue. but adding output parser may solve the issue for now.

@arifsetyawan Can you please tell me what is the output node?

@Ranjitha I have been experiencing the same issue and just figured out a work around based on this chat.

I am running n8n v 1.105.3 but this issue has been happening with any n8n version after 1.102.4. I believe it is linked to the langchain version update.

simple flow but it results in the error “Cannot read properties of null (reading ‘length’)” from the agent.

However if I copy the flow, paste it in vscode and override the version of the agent node from 2.1 to 1.8 and paste it back into the n8n canvas, it works just fine.


      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        208,
        0
      ]

I haven’t experimented with any other @n8n/n8n-nodes-langchain.agent agent versions.

I forgot to mention that I am using LiteLLM as a proxy and overriding the url for the OpenAI node to use it in n8n

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