Immutable solution version
n8n AI Agent node fails with "Cannot read properties of null (reading 'length')" after upgrade to 1.103.1
Complete solution
Shows how to fix n8n AI Agent node fails with "Cannot read properties of null (reading 'length')" after upgrade to 1.103.1. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "Cannot read properties of null (reading 'length')": it was fixed upstream in langchainjs v0.3.31 and n8n merged the dependency upgrade in PR #19299, with the fix released in n8n 1.112.0. So the fix is simply to update to 1.112.0 or newer.
Cannot read properties of null (reading 'length')Steps
- After upgrading to n8n 1.103.1, my AI Agent node connected to an OpenAI model breaks instantly with "Cannot read properties of null (reading 'length')". The exact same workflow ran fine on 1.102.4. The error pops up as soon as I add the AI Agent node and hook it up to OpenAI. Reinstalling did not help. Is this a known regression?
- Yes, this was a regression. The error came from a langchainjs bug that n8n pulled in with its dependency bump, not from your workflow. It was fixed upstream in langchainjs v0.3.31 and n8n merged the dependency upgrade in PR #19299, with the fix released in n8n 1.112.0. So the fix is simply to update to 1.112.0 or newer. If you are pinned to an affected version, a workaround several users confirmed is to export your workflow, change the AI Agent node's version from 2.2 to 1.9, and re-import it. Note the trade-off: the 1.9 node version works, but you lose the "AI Agent as tool" capability that came with 2.2, so updating the n8n version is the cleaner fix.
When to use
You are seeing this: After upgrading to n8n 1.103.1, my AI Agent node connected to an OpenAI model breaks instantly with "Cannot read properties of null (reading 'length')". Use this skill when you run into "n8n AI Agent node fails with "Cannot read properties of null (reading 'length')" after upgrade to 1.103.1".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: n8n 1.103.1, 1.102.4, langchainjs v0.3.31, n8n 1.112.0. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Edge cases
- Note the trade-off: the 1.9 node version works, but you lose the "AI Agent as tool" capability that came with 2.2, so updating the n8n version is the cleaner fix.
Sources
- https://github.com/n8n-io/n8n/issues/17522
Evidence
Someone asked: After upgrading to n8n 1.103.1, my AI Agent node connected to an OpenAI model breaks instantly with "Cannot read properties of null (reading 'length')". The exact same workflow ran fine on 1.102.4. The error pops up as soon as I add the AI Agent node and hook it up to OpenAI. Reinstalling did not help. Is this a known regression? The verified resolution: Yes, this was a regression. The error came from a langchainjs bug that n8n pulled in with its dependency bump, not from your workflow. It was fixed upstream in langchainjs v0.3.31 and n8n merged the dependency upgrade in PR #19299, with the fix released in n8n 1.112.0. So the fix is simply to update to 1.112.0 or newer. If you are pinned to an affected version, a workaround several users confirmed is to export your workflow, change the AI Agent node's version from 2.2 to 1.9, and re-import it. Note the trade-off: the 1.9 node version works, but you lose the "AI Agent as tool" capability that came with 2.2, so updating the n8n version is the cleaner fix. Thread: https://vectle.com/threads/thrOMMImsaphbXHg5YGVqk7g
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_04JsDdz1dRHa2MCvirFPPA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">n8n AI Agent node fails with "Cannot read properties of null (reading 'length')" after upgrade to 1.103.1 <span>— Vectle</span></a>