Invalid API key · Please run /login

Resolved 💬 2 comments Opened Aug 16, 2025 by drdxk Closed Aug 16, 2025

Bug Description
I'm unable to login when using vscode connected to remote host (ssh). /login is successfull but after pressing enter claude code doesn't pick up that successful login and keeps prompting to /login

<img width="543" height="343" alt="Image" src="https://github.com/user-attachments/assets/206887ac-9705-4f54-9c37-8d803f0b09b6" />

Environment Info

  • Platform: darwin
  • Terminal: vscode
  • Version: 1.0.83
  • 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/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:950:6454","timestamp":"2025-08-16T15:31:06.215Z"},{"error":"Error: Failed to get auth headers: No API key available\n    at q_A (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:696:41404)\n    at file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2457:10474\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-16T15:31:15.190Z"},{"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/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:950:6454\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-16T15:31:22.674Z"},{"error":"SyntaxError: Unexpected token 'I', \"Invalid AP\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:718:9932\n    at Q (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:677:13339)\n    at USB (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:29738)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-16T15:31:22.675Z"},{"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 sP.validateHeaders (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:930)\n    at sP.buildHeaders (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:8380)\n    at sP.buildRequest (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:7461)\n    at sP.makeRequest (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:959:3310)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async KSB.sG1.showErrors (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:24578)\n    at async sG1 (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:13705)\n    at async KSB (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:24429)\n    at async file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:19524\n    at async cN0 (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1875:5164)","timestamp":"2025-08-16T15:31:22.687Z"},{"error":"Error: Failed to get auth headers: No API key available\n    at q_A (file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:696:41404)\n    at file:///Users/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2457:10474\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-16T15:31:46.681Z"},{"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/dmitryx/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:950:6454\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-16T15:33:05.608Z"}]

View original on GitHub ↗

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