API Error: 401 {"type":"error","error":{"type":"authenticati...
Resolved 💬 59 comments Opened Jul 10, 2025 by jackrobertscott Closed Jul 10, 2025
Bug Description
API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid OAuth token. The provided token
was not found or is malformed."}}
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 1.0.44
- Feedback ID: b5e5486b-26ac-409a-b1c6-b839f8ac9f21
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:892:11)\n at execSync (node:child_process:964:15)\n at wD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9350\n at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n at uC (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:8496)\n at hC (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:7361)\n at wB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11970)","timestamp":"2025-07-10T00:40:04.277Z"},{"error":"Error: Command failed: security delete-generic-password -a $USER -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:892:11)\n at execSync (node:child_process:964:15)\n at wD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n at TpA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:10462)\n at OpA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:10336)\n at k9A (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2125:2567)\n at e01.startOAuthFlow (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2125:3733)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-10T00:40:14.822Z"},{"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:892:11)\n at execSync (node:child_process:964:15)\n at wD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9350\n at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n at uC (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:8496)\n at hC (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:7361)\n at wB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11970)","timestamp":"2025-07-10T00:40:14.890Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"Invalid OAuth token. The provided token was not found or is malformed.\"}}\n at D6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n at gq.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n at gq.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-10T00:40:29.556Z"},{"error":"SyntaxError: Unexpected token 'A', \"API Error:\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:9971\n at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n at Lw2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1337:10306)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-10T00:40:29.567Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"Invalid OAuth token. The provided token was not found or is malformed.\"}}\n at D6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n at gq.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n at gq.makeRequest (file:///opt/homebrew/
Note: Error logs were truncated.
59 Comments
Just ran into the same issue.
I tried logout and deleted ~/.claude and ~/.claude.json, then login again. Still the same error.
same error here, confirmed
same here
same here
same here
same here;)
Same here. https://status.anthropic.com/ doesn't show outage.
Good to see we're all here.
can we open an issue for a better error message? I got panic
Same problem。 what happend?
Same here
Same -- logged out/in, ran /doctor, restarted. issue remains
Same here
same here
Yes. A basic message there would have been helpful, that reduces the panic to be honest. Also a command line switch to see such status in claudecode would be nice. The login issues are horrible, somewhat reduces with proxies sometimes.
same
+1
same here. /logout restarted machine , ran claude update /login
+1
+1
Same on my side, and it happened at the worse step possible...
+1
Same here
Same here
+1
same
same
+1
+1
same
Same issue. Also claude desktop for mac is not loading
same here
+1
+1
Just react to the original comment so there is't a huge thread for when we need to see solution
+1
guys which video do i need to watch ?, i forgot how to code.
+10000
I've switched to Gemini CLI for the moment and I feel like a damned animal
same here
same herer
+1
🫠
same... forced to go outside and get some sun now
Same.
Error : API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid OAuth token. The provided token was not found or is malformed."}}
Version: 1.2.2
VSCode Version: 1.99.3
Date: 2025-07-07T06:19:13.016Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045
It's working again
Deleted .claude and relogin, seems working now
<img width="1353" height="627" alt="Image" src="https://github.com/user-attachments/assets/ac333cf0-a976-476d-a0cf-bb7590b00382" />
Ran /doctor and it recommended /migrate-installer. I followed the instructions there, restarted my shell, and now it's working. Could be a coincidence, but I'm back in.
Tried running
npm i -g @anthropic-ai/claude-codein terminal and it works nowI am on max plan but I only see the sonnet model.
Works for me:
unalias claudenpm install -g @anthropic-ai/claude-code@1.0.47it works
Yes working again :)
works for me now
Working
It is working now.
Fixed
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.