API Error: Cannot read properties of undefined (reading...

Resolved 💬 34 comments Opened Jul 30, 2025 by audioternal Closed Aug 22, 2025
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
API Error: Cannot read properties of undefined (reading 'filter')

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 1.0.63
  • Feedback ID:

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:984:15)\n    at wrappedFn (node:internal/errors:538:14)\n    at checkExecSyncError (node:child_process:891:11)\n    at execSync (node:child_process:963:15)\n    at p7 (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:865:5108)\n    at file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:776:48959\n    at Q (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:674:14420)\n    at kJ (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:776:46397)\n    at XH (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:776:45264)\n    at Y9 (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:776:51585)","timestamp":"2025-07-30T16:53:52.113Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:490:14)\n    at Socket.emit (node:events:524:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:561:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)\n    at Readable.push (node:internal/streams/readable:392:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)","timestamp":"2025-07-30T16:53:54.836Z"},{"error":"Error: request ended without sending any chunks\n    at C71.A (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:1325:11973)\n    at C71._createMessage (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:1325:7982)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-07-30T16:53:55.567Z"},{"error":"Error: request ended without sending any chunks\n    at C71.A (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:1325:11973)\n    at C71._createMessage (file:///Users/moset/.nvm/versions/node/v20.19.3/lib/node_modules/@anthropic-ai/claude-code/cli.js:1325:7982)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-07-30T16:55:33.269Z"}]

View original on GitHub ↗

34 Comments

audioternal · 11 months ago

Strange it looks as if it wants my password

ashwin-ant collaborator · 11 months ago

Can you describe when this occurred?

audioternal · 11 months ago

It occurred when I tried to chat with the Claude cli. I just wrote hi to see if it could receive a request.

My .env file

ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
ANTHROPIC_AUTH_TOKEN={xxxxxx redacted}
ANTHROPIC_MODEL="glm-4.5”

audioternal · 11 months ago

My /status
Claude Code Status v1.0.63

L Session ID: 3eccfd81-6e52-4127-aa78-09d7f3a44c71

Working Directory
L /Users/moset/tmuxorchestratorkilo/Tmux-Orchestrator

System Diagnostics • /doctor
⚠ Insufficient permissions for auto-updates
⚠ No write permissions for auto-updates (requires sudo)
⚠ Config mismatch: running npm-global but config says unknown

Account
L Auth Token: ANTHROPIC_AUTH_TOKEN

API Configuration
L Anthropic Base URL: https://api.z.ai/api/anthropic

Memory • /memory
L project: CLAUDE.md

Model • /model
L glm-4.5

I also removed the {} around the key and all the ". Now nothing happens and I have no error. And in the dashboard the key has never been used...

ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic
ANTHROPIC_AUTH_TOKEN=xxxxxx retarded
ANTHROPIC_MODEL=glm-4.5

IRediTOTO · 11 months ago

same here

linkedlist771 · 11 months ago

hi, did you solve it? I am still struggling about this.

github-actions[bot] · 11 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/4781

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

perfumescent · 11 months ago

same here

marktheminer · 11 months ago

I've hit the same using openrouter

<img width="1231" height="718" alt="Image" src="https://github.com/user-attachments/assets/6457497e-f2ba-453e-a9ea-e3ae9a041236" />

zhongmaomao · 11 months ago

same to me

jarvis-u · 11 months ago

same to me

Likesclown · 11 months ago

same to me

OoOPenN · 11 months ago

same to me

H0wAway · 11 months ago

+1

nekokristalo · 11 months ago

same
<img width="1235" height="688" alt="Image" src="https://github.com/user-attachments/assets/127fcfaa-9a1d-4991-a7cf-7510689b65e5" />

ashwin-ant collaborator · 11 months ago

Is everyone seeing this using a custom ANTHROPIC_BASE_URL?

nekokristalo · 11 months ago
每个人都使用自定义来看到这一点吗ANTHROPIC_BASE_URL

yes

linkedlist771 · 11 months ago

I have solved it using the Claude Code proxy to wrap it again.

jzhang-bgl · 11 months ago
I have solved it using the Claude Code proxy to wrap it again.

@linkedlist771 cool, can you share the config how to solve it?

linkedlist771 · 11 months ago
> I have solved it using the Claude Code proxy to wrap it again. @linkedlist771 cool, can you share the config how to solve it?

I am a little busy right now, I will update my method later. Stay tuned

ZERO-A-ONE · 11 months ago

same to me

ReberMusk · 10 months ago
> > I have solved it using the Claude Code proxy to wrap it again. > > > @linkedlist771 cool, can you share the config how to solve it? I am a little busy right now, I will update my method later. Stay tuned

waiting for u bro

lixin4sky · 10 months ago

same to me.

Xuuuuu04 · 10 months ago

我也补充一个临时解决方案和问题情况
问题描述
在 macOS(Apple Silicon M1)及 Windows 11 系统上,使用包括 Moonshot KIMI K2、GLM-4.5、silicon 等在内的多种三方 Anthropic-format 接口时,均出现了以下错误提示:

API Error: Cannot read properties of undefined (reading 'filter')

在对话进行到第 8 - 20 轮时(并非固定轮次,有时可能会较晚出现,但基本在满上下文对话的前 1 - 2 轮内几乎必定复现),模型大概率会崩溃。在某些运气不佳的情况下,对话刚进行前两轮,即模型即将执行 TODO 工具规划阶段时,就会出现概率性崩溃的情况。目前,我尚未能够定位该问题出现的原因及具体代码位置。

临时解决方案
经过反复测试,发现将流量切换至 GitHub 上的 Claude Code Router 项目后,可通过该项目将第三方 OpenAI 端点转换为 Anthropic 格式,并插入至 Claude Code 中,从而实现稳定使用,未再出现上述错误。据推测,该问题无法通过特定的请求稳定复现,较为棘手,目前处于可用但频繁报错、需要频繁重启的不稳定状态。若其他用户也有类似需求,我个人建议尝试使用类似 proxy/router 项目来转接 OpenAI,目前该方法表现稳定。

I also add a temporary solution and problem situation.
English Version
Issue Description
When using various third-party Anthropic-format interfaces, including Moonshot KIMI K2, GLM-4.5, silicon, etc., on macOS (Apple Silicon M1) and Windows 11, the following error occurs:

API Error: Cannot read properties of undefined (reading 'filter')

During conversations, this error tends to emerge between the 8th and 20th rounds (though it's not fixed at a specific round; sometimes it may appear later, but it is almost certain to occur within the first 1 - 2 rounds of full context conversation), causing the model to crash with high probability. In some unfortunate cases, just after the first two rounds of dialogue, as the model is about to execute the TODO tool planning phase, it may crash probabilistically. At present, I have not been able to pinpoint the exact cause and location of this issue.

Temporary Solution
After extensive testing, I have found that switching to the Claude Code Router project on GitHub allows for stable usage. This project converts third-party OpenAI endpoints to the Anthropic format and integrates them into Claude Code, without encountering the aforementioned error. It appears that the issue can't be reliably reproduced through a specific request, making it quite tricky. The current situation is that it can be used to some extent, but it keeps throwing this error and requires frequent restarts. If you also need to use it, I personally recommend using proxy/router projects to relay OpenAI, which has proven to be stable so far.

icowan · 10 months ago

same to me

igorkofman collaborator · 10 months ago

Closing as not a Claude Code issue but an issue with proxies.

JoeABCDEF · 10 months ago

当指定 以下变量应该是 就没问题了

export ANTHROPIC_MODEL="xxx"
export ANTHROPIC_SMALL_FAST_MODEL="xxx"

指定的是 claude-xxx 对应的模型, 就没问题了, 我自己 不配置基本 创建任务 百分百会复现, 但是加上没遇到了 , 我也是第三方代理

luohui1 · 10 months ago

我也是如此,求方案

songyaolun · 10 months ago

有解决方案了吗,测了CCR和的指定模型配置,还是会出现这种情况

zyoung1212 · 10 months ago

same to me

Jiangqiesi · 10 months ago
> > I have solved it using the Claude Code proxy to wrap it again. > > > @linkedlist771 cool, can you share the config how to solve it? I am a little busy right now, I will update my method later. Stay tuned

waiting for u bro

linkedlist771 · 10 months ago
> > I have solved it using the Claude Code proxy to wrap it again. > > > @linkedlist771 cool, can you share the config how to solve it? I am a little busy right now, I will update my method later. Stay tuned

I am using the https://github.com/1rgs/claude-code-proxy project to warp it again for support the Claude Code proxy usage. This project converts a openai compatiable API into the claude one. So your third party api should:

  1. Be OpenAI API compatiable.
  2. Support OpenAI API function call(This is the most important part, for this where the tool use works).

After delopy this project, you can reset the ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL, it should works fine now. There should be some more models support the OpenAI API SDK style, as for the function call, if it is not supported. You may manually inject the tool use prompt and parse the cumulative delta message then parse the function call json and add this field. Here is how vllm does for the manually function call https://github.com/vllm-project/vllm/blob/2554b27baa58b15843367f92d7f73d71bb89033d/vllm/entrypoints/openai/tool_parsers/kimi_k2_tool_parser.py.

perfumescent · 10 months ago
当指定 以下变量应该是 就没问题了 `` export ANTHROPIC_MODEL="xxx" export ANTHROPIC_SMALL_FAST_MODEL="xxx" `` 指定的是 claude-xxx 对应的模型, 就没问题了, 我自己 不配置基本 创建任务 百分百会复现, 但是加上没遇到了 , 我也是第三方代理

没用啊

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.