API Error: 401 {"type":"error","error":{"type":"authenticati...

Status Closed — duplicate
Maintainer reply None cached
Activity 11 comments · opened Jul 10, 2025 · 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: linux
  • Terminal: tmux
  • Version: 1.0.44
  • Feedback ID: e76da2de-7633-4be7-a8fa-d141328497af

Errors

[{"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:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/lazydino/.npm-global/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:54:59.131Z"},{"error":"SyntaxError: Unexpected token 'A', \"API Error:\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:9971\n    at Q (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n    at Lw2 (file:///home/lazydino/.npm-global/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:54:59.141Z"},{"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:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async fA1.showErrors (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23214)\n    at async fA1 (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:12720)\n    at async aR2 (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23062)\n    at async file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18138\n    at async Y0A (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:5121)\n    at async Vc (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18108)","timestamp":"2025-07-10T00:54:59.405Z"},{"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:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/lazydino/.npm-global/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-10T01:00:10.681Z"},{"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:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async fA1.showErrors (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23214)\n    at async fA1 (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:12720)\n    at async aR2 (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23062)\n    at async file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18138\n    at async Y0A (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:5121)\n    at async Vc (file:///home/lazydino/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18108)","timestamp":"2025-07-10T01:00:11.081Z"},{"error":"Error: 401 {\"type\"

Note: Error logs were truncated.

View original on GitHub ↗

11 Comments

BN-JuzzyP · 1 year ago

I am also receiving this error on Mac

egantz · 1 year ago

+1

imaddyx · 1 year ago

+1

Gekko0114 · 1 year ago

+1

suimye · 1 year ago

+1 I got same error from /init.

chans00n · 1 year ago

+1

jacker818 · 1 year ago

+1 Same here

nor-85 · 1 year ago

Similar issues are reported one after another.

clarity1997 · 1 year ago

+1

Gekko0114 · 1 year ago

Fixed, thanks. I can write code now

github-actions[bot] · 1 year 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.