Invalid API key · Please run /login
Bug Description I'm getting "Invalid API Key" even though I just logged in again, and again.. this seems to be only happening on one computer I SSH into. I have logged out and logged back in and restarted the computer. When I first got the error I was in the middle of a conversation and when i exited out it said I had consumed 99$ of api even though i am on the 200$ max plan.. also when logging in to check my api usage, it all says 0 (correctly)
Environment Info
- Platform: darwin
- Terminal: cursor
- Version: 1.0.69
- 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:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1270:6454\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-05T21:49:53.163Z"}]
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/5151
- https://github.com/anthropics/claude-code/issues/5167
- https://github.com/anthropics/claude-code/issues/5166
If your issue is a duplicate, please close it and 👍 the existing issue instead.
🤖 Generated with Claude Code
No solutions on those duplicate issues!
This issue is still happening I'm noticing it happens every day maybe 24 hours? The way I fix it is:
- Uninstall Claude Code
- Install 1.00.67
- LogIn
- /Exit
- Open Claude Code
This resolves the problem temporarily for at least 24 hours.
When first exiting CC after getting the message I get this:
I am not using the API. I'm a MAX user. I do have a API account with usage limits just in case
Update, Still having this issue daily. No permanent fix yet.
Still usign 1.0.67. Even after 1.0.84 update...
I tried lots of things, unistalled, removed folder, re installed global, local, re login, logout, re login, migrate etc... None works....
I'm seeing this too if we can try to address this better.
im getting this now too. first VS code, then cursor.. ive deleted all storage key files etc. nothing works. CLI works just fine in the IDE but this is a real problem that we need to address asap. its getting very messy with short term repair techniques, if any exist anymore..
who has an update, anybody?
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Commenting here as well since this feels a bit more recent. My coworker solved this issue via https://github.com/anthropics/claude-code/issues/64#issuecomment-2683207735
which we both think is a bit of an oddity fix-wise, but if it works for any of the other people struggling w/ this issue, hopefully it can unblock 'em...