claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

I am seeing API Error: 401 {"type":"error","error":{"type":"...

Open Jingwei-dev99 opened this issue 1 year ago • 10 comments

Bug Description I am seeing API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid bearer token"}} though I have already login with my max plan

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 1.0.53
  • 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:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at AI (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:728:6320)\n    at file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:640:16554\n    at Q (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:542:14406)\n    at MF (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:640:14339)\n    at zX (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:640:13205)\n    at MB (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:640:19174)","timestamp":"2025-07-16T12:45:15.226Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:481:14)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-07-16T12:45:19.213Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"Invalid bearer token\"}}\n    at eQ.generate (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:1180:6463)\n    at k$.makeStatusError (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:1197:2101)\n    at k$.makeRequest (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:1197:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async aB1.showErrors (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:2594:14107)\n    at async aB1 (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:2140:1658)\n    at async qBB (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:2594:13956)\n    at async file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:2594:9065\n    at async DIA (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:2594:1626)\n    at async Yp (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:2594:9035)","timestamp":"2025-07-16T12:45:22.807Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"Invalid bearer token\"}}\n    at eQ.generate (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:1180:6463)\n    at k$.makeStatusError (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:1197:2101)\n    at k$.makeRequest (file:///Users/jessie/node_modules/@anthropic-ai/claude-code/cli.js:1197:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-16T12:45:57.040Z"}]

Jingwei-dev99 avatar Jul 16 '25 12:07 Jingwei-dev99

Still ongoing since yesterday

dardameiz avatar Jul 16 '25 13:07 dardameiz

/logout and log back in.

adagradschool avatar Jul 16 '25 18:07 adagradschool

unset ANTHROPIC_BASE_URL ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN 

Solved for me.

Zijie-Tian avatar Aug 18 '25 12:08 Zijie-Tian

unset ANTHROPIC_BASE_URL ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN 

Solved for me.

Solved for me as well

DenisBytes avatar Aug 19 '25 15:08 DenisBytes

unset ANTHROPIC_BASE_URL ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN 

Solved for me.

Solved for me, thanks.

zfanswer avatar Aug 24 '25 07:08 zfanswer

renew this bug. It still shows in version 1.0.111 when use 'claude -p'. But in version 1.0.110 is on.

retanoj avatar Sep 11 '25 12:09 retanoj

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 08 '25 10:12 github-actions[bot]

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] avatar Jan 08 '26 10:01 github-actions[bot]

i have this issue now...

sturlei avatar Jan 12 '26 14:01 sturlei

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.

github-actions[bot] avatar Jan 20 '26 14:01 github-actions[bot]