Skip to content

[BUG] 401 "Invalid API key" authentication error on Windows with Claude Pro subscription #28155

Description

@DucHieu2003

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Description

After logging in successfully with Claude Pro subscription, every API call returns
a 401 authentication error. Login succeeds but actual requests fail immediately.

Environment

  • Claude Code version: v2.1.52
  • OS: Windows 10 (10.0.19045)
  • Shell: PowerShell
  • Node.js version: [chạy node -v rồi điền vào đây]
  • Auth method: claude.ai (OAuth)
  • Subscription: Claude Pro

Auth Status

{
  "loggedIn": true,
  "authMethod": "claude.ai",
  "apiProvider": "firstParty",
  "email": "***@gmail.com",
  "orgId": "***",
  "orgName": "***'s Organization",
  "subscriptionType": "pro"
}

### What Should Happen?

..

### Error Messages/Logs

```shell
401 {"type":"error","error":{"type":"authentication_error","message":"Invalid API key"}}
Retrying in 14 seconds… (attempt 6/10)

Steps to Reproduce

..

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.52

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authbugSomething isn't workingneeds-infoIssue needs more information to be actionableplatform:windowsIssue specifically occurs on Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions