Claude code execution fails in-between session, Api error 401 is shown. its an authentication.
Resolved 💬 3 comments Opened Aug 21, 2025 by swapnilsurdi Closed Aug 21, 2025
Bug Description
gets 401 suddenly while executing. its an authentication error
Environment Info
- Platform: linux
- Terminal: vscode
- Version: 1.0.86
- Feedback ID: 95087053-fd55-46b6-91af-cb1bec2ae09c
Errors
[{"error":"Error: Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the \"X-Api-Key\" or \"Authorization\" headers to be explicitly omitted\n at file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:940:6454\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-08-21T20:56:00.502Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CSMXUxHeDQ6CaMgEv6HYq\"}\n at b4.generate (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:932:2447)\n at dP.makeStatusError (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:2101)\n at dP.makeRequest (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:5315)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-08-21T20:59:02.961Z"},{"error":"SyntaxError: Unexpected token 'A', \"API Error:\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:718:9932\n at Q (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:677:13339)\n at zs2 (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1061:1992)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-08-21T20:59:02.967Z"},{"error":"MaxFileReadTokenExceededError: File content (29499 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n at U1B (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1776:432)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Object.call (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1771:994)\n at async cN8 (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3400:10483)\n at async puB (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3400:6802)\n at async L1B (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1776:3411)\n at async XQB (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1950:2562)\n at async dN8 (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3400:6013)\n at async gN8 (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3400:5385)\n at async MU (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3400:2908)","timestamp":"2025-08-21T20:59:08.822Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CSMXZo9MxzNKEGjYCwT41\"}\n at b4.generate (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:932:2447)\n at dP.makeStatusError (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:2101)\n at dP.makeRequest (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:5315)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async LD1.showErrors (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:27238)\n at async LD1 (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:16345)\n at async l9B (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:27089)\n at async file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:22183\n at async dH0 (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:3514)\n at async V11 (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:22153)","timestamp":"2025-08-21T21:00:08.650Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CSMXafJ7YXg1ehPuuUdZD\"}\n at b4.generate (file:///usr/local/share/npm-global/lib/node_modules/@anthropic-ai/claude-code/
Note: Error logs were truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗