Invalid API key · Please run /login
Resolved 💬 3 comments Opened Aug 21, 2025 by jeremy-martin-playon Closed Aug 25, 2025
Bug Description
I am using Claude Code on my mac. I have a claude max pro account, and it asks me to log in using a browser. I do NOT use an API key with my plan, and I have never entered an API key. However, it keeps giving me this error, even after I log in successfully:
Invalid API key · Please run /login
Environment Info
- Platform: darwin
- Terminal: ssh-session
- Version: 1.0.86
- Feedback ID:
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:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:940:6454","timestamp":"2025-08-21T18:44:55.809Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n at Socket.onChildStdout (node:child_process:481:14)\n at Socket.emit (node:events:524:28)\n at Socket.emit (node:domain:489:12)\n at addChunk (node:internal/streams/readable:561:12)\n at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)\n at Readable.push (node:internal/streams/readable:392:5)\n at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-08-21T18:44:56.684Z"},{"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:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:940:6454\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-21T18:45:05.648Z"},{"error":"SyntaxError: Unexpected token 'I', \"Invalid AP\"... is not valid JSON\n at JSON.parse (<anonymous>)\n at file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:718:9932\n at Q (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:677:13339)\n at zs2 (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1061:1992)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-21T18:45:05.649Z"},{"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 dP.validateHeaders (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:930)\n at dP.buildHeaders (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:8380)\n at dP.buildRequest (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:7461)\n at dP.makeRequest (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:949:3310)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async LD1.showErrors (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:27238)\n at async LD1 (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:16345)\n at async l9B (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:27089)\n at async file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:22183\n at async dH0 (file:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1904:3514)","timestamp":"2025-08-21T18:45:05.662Z"},{"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:///Users/jeremy.martin/.nvm/versions/node/v22.12.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:940:6454\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-21T18:51:52.343Z"}]This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗