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

relogin many time but : "API Error: 401...

Open babim opened this issue 1 year ago • 18 comments

Bug Description relogin many time but : "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: WarpTerminal
  • Version: 1.0.44
  • Feedback ID: c4e6d4ef-5467-4ff1-8cee-db880babe70f

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:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-07-10T00:52:10.722Z"},{"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:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-07-10T00:52:11.499Z"},{"error":"SyntaxError: Unexpected token 'A', \"API Error:\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:9971\n    at Q (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n    at Lw2 (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1337:10306)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-07-10T00:52:11.505Z"},{"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:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async fA1.showErrors (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23214)\n    at async fA1 (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:12720)\n    at async aR2 (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23062)\n    at async file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18138\n    at async Y0A (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:5121)\n    at async Vc (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18108)","timestamp":"2025-07-10T00:52:12.188Z"},{"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:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-07-10T00:52:14.877Z"},{"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:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async fA1.showErrors (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23214)\n    at async fA1 (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:12720)\n    at async aR2 (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23062)\n    at async file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18138\n    at async Y0A (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:5121)\n    at async Vc (file:///usr/lib/node_modules/@a

Note: Error logs were truncated.

babim avatar Jul 10 '25 00:07 babim

I just started running into this too.

joshsymonds avatar Jul 10 '25 00:07 joshsymonds

Same here Running on Mac OS

john-savepoint avatar Jul 10 '25 00:07 john-savepoint

Same, after trying all fixes in https://github.com/anthropics/claude-code/issues/1484 and https://github.com/anthropics/claude-code/issues/1746

adambuttrick avatar Jul 10 '25 00:07 adambuttrick

Same here.

ricardotech avatar Jul 10 '25 00:07 ricardotech

same here suddenly right now.

takahiro-saeki avatar Jul 10 '25 00:07 takahiro-saeki

Same here, I guess its just an error on Anthropics side

JasonNotJson avatar Jul 10 '25 00:07 JasonNotJson

FYI for others who didn't know this. If you closed the conversation to try to reconnect, you can resume your previous conversation with /resume

tansanDOTeth avatar Jul 10 '25 00:07 tansanDOTeth

FYI for others who didn't know this. If you closed the conversation to try to reconnect, you can resume your previous conversation with /resume

Wow here I was trying to load context into new chats manually :(

rnmp avatar Jul 10 '25 01:07 rnmp

We paged our accounts oncall and are trying to address the issue ASAP.

dicksontsai avatar Jul 10 '25 01:07 dicksontsai

Yeah, for $200USD per month....

~173 working hours per month (40 hours × 52 weeks ÷ 12 months) $200 ÷ 173 hours = $1.16 per hour

Just saying.... refunds no matter how small are appreciated when Anthropic is heartless about charging you for every API call no matter how erroneous (the case before Claude MAX).

EDIT: Back online within 10minutes of this going up. That is why Anthropic is a leader, shouldn't happen but when it does they take care of it. I won't delete the post, it's a reminder to Anthropic that we count the beans too.

john-savepoint avatar Jul 10 '25 01:07 john-savepoint

Hey its now working on my side

JasonNotJson avatar Jul 10 '25 01:07 JasonNotJson

anthropics Fixed

babim avatar Jul 10 '25 01:07 babim

May the vibe be with everyone

JasonNotJson avatar Jul 10 '25 01:07 JasonNotJson

The incident should now be resolved. Thank you for your patience.

- Claude Code oncall

dicksontsai avatar Jul 10 '25 01:07 dicksontsai

I'm still getting the same API error 401. The version is 1.0.48.

kyeongjunJang avatar Jul 11 '25 02:07 kyeongjunJang

it was working yesterday but today (2025-07-22, two weeks after this issue was first posted) I had the same problem, on the AUR package claude-code-1.0.55-1. I removed it and installed the latest 1.0.57 from npm, which fixed it

veilm avatar Jul 22 '25 16:07 veilm

I'm still having this same exact issue, which started yesterday for me. I hate to open another ticket as they seem to get closed as a duplicate.... but it's still an issue.

heathermharmon avatar Jul 24 '25 11:07 heathermharmon

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 Jul 31 '25 14:07 github-actions[bot]