I am getting a 401 error with the message Invalid OAuth token.

Resolved 💬 4 comments Opened Jul 10, 2025 by jordanallred Closed Jul 10, 2025

Bug Description
I am getting a 401 error with the message Invalid OAuth token. The provided token was not found or is malformed. I am authenticated with my Pro account. I have tried logging out and logging back in. I have even deleted claude code and reinstalled. I even made sure to remove all ~/.claude files and directories.

Environment Info

  • Platform: linux
  • Terminal: gnome-terminal
  • Version: 1.0.44
  • Feedback ID: d277ffe3-956e-47d2-b002-c5de6ec9662c

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/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/jo/.npm-global/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:56:03.519Z"},{"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/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/jo/.npm-global/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:56:04.150Z"},{"error":"SyntaxError: Unexpected token A in JSON at position 0\n    at JSON.parse (<anonymous>)\n    at file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:9971\n    at Q (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n    at Lw2 (file:///home/jo/.npm-global/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:56:04.152Z"},{"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/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/jo/.npm-global/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:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23214)\n    at async fA1 (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:12720)\n    at async aR2 (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23062)\n    at async file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18138\n    at async Y0A (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:5121)\n    at async Vc (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18108)","timestamp":"2025-07-10T00:56:05.107Z"},{"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/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1304:12612)\n    at gq.makeStatusError (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1321:2100)\n    at gq.makeRequest (file:///home/jo/.npm-global/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:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23214)\n    at async fA1 (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:12720)\n    at async aR2 (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:23062)\n    at async file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18138\n    at async Y0A (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:5121)\n    at async Vc (file:///home/jo/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1690:18108)","timestamp":"2025-07-10T00:56:12.115Z"},{"error":"Error: 401 {\"type\":\"error\"

Note: Error logs were truncated.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗