[BUG] Windows: Claude Console Login – API Key Not Available After Successful Login (Process Exits with Code 1)

Resolved 💬 3 comments Opened Feb 25, 2026 by RajenderPash Closed Mar 1, 2026

Preflight Checklist

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

What's Wrong?

On a Windows machine, after completing the Console OAuth login flow successfully in VS Code, Claude reports that the API key was created and saved. However, immediately after login, Claude fails with an authentication error:

Auth error: No API key available

The logs show:

API key is created

API key is saved to the config file

Login is marked as successful

Authentication status is checked

Then Claude fails with “No API key available”

Claude process exits with code 1

Additionally, there is a 401 error while fetching subscription:
Failed to fetch subscription: AxiosError: Request failed with status code 401

Because of this error, Claude shuts down and cannot be used after login.

This appears to be an issue where the API key is either:

Not being properly read from the config file,

Not available to the Claude process at runtime, or

Being cleared/overwritten immediately after login.

What Should Happen?

After completing the Console OAuth login flow on Windows:

The API key should be successfully created and saved.

Claude should correctly read the API key from the config file.

Authentication status should remain valid.

Subscription check (if applicable) should complete without a 401 error.

Claude should stay active and ready to use.

The Claude Code process should continue running without exiting.

There should be no “No API key available” error, and the process should not exit with code 1 after a successful login.

Error Messages/Logs

2026-02-25 16:29:48.045 [info] Received message from webview: {"type":"request","requestId":"2ryty29ats7","request":{"type":"login","method":"console"}}
2026-02-25 16:29:48.046 [info] Starting OAuth login flow: method=console
2026-02-25 16:29:55.351 [error] Failed to fetch subscription: AxiosError: Request failed with status code 401
2026-02-25 16:29:55.433 [info] Creating API key for Console user
2026-02-25 16:29:55.898 [info] Saving API key
2026-02-25 16:29:55.898 [info] API key saved to config file
2026-02-25 16:29:55.908 [info] Login successful
2026-02-25 16:29:55.908 [info] Getting authentication status
2026-02-25 16:29:55.932 [info] API key found in config file
2026-02-25 16:29:55.934 [info] Closing Claude on channel: bgl5rw08jgm
2026-02-25 16:29:56.169 [info] From claude: 2026-02-25T16:29:56.169Z [DEBUG] LSP server manager shut down successfully

2026-02-25 16:29:56.222 [info] From claude: 2026-02-25T16:29:56.223Z [DEBUG] Failed to check metrics opt-out status: Auth error: No API key available

2026-02-25 16:29:56.223 [info] From claude: 2026-02-25T16:29:56.224Z [ERROR] "Error: Error: Auth error: No API key available\n    at TQf (B:/~BUN/root/claude.exe:2419:25318)\n    at X_E (B:/~BUN/root/claude.exe:2419:25594)\n    at <anonymous> (B:/~BUN/root/claude.exe:112:19034)\n    at Dq$ (B:/~BUN/root/claude.exe:2419:26288)\n    at doExport (B:/~BUN/root/claude.exe:2419:27106)\n    at export (B:/~BUN/root/claude.exe:2419:26812)\n    at <anonymous> (B:/~BUN/root/claude.exe:118:165451)\n    at <anonymous> (B:/~BUN/root/claude.exe:118:165391)\n    at new Promise (native:1:11)\n    at GE0 (B:/~BUN/root/claude.exe:118:165368)"

2026-02-25 16:29:56.227 [info] From claude: 2026-02-25T16:29:56.224Z [DEBUG] Metrics export disabled by organization setting
2026-02-25T16:29:56.224Z [DEBUG] BigQuery metrics exporter flush complete
2026-02-25T16:29:56.224Z [DEBUG] BigQuery metrics exporter flush complete
2026-02-25T16:29:56.224Z [DEBUG] BigQuery metrics exporter shutdown complete
2026-02-25T16:29:56.225Z [DEBUG] Getting matching hook commands for SessionEnd with query: other
2026-02-25T16:29:56.225Z [DEBUG] Found 0 hook matchers in settings
2026-02-25T16:29:56.225Z [DEBUG] Matched 0 unique hooks for query "other" (0 before deduplication)

2026-02-25 16:29:56.701 [info] Closing Claude on channel: bgl5rw08jgm
2026-02-25 16:29:56.702 [error] Error from Claude (on channel bgl5rw08jgm): Error: Claude Code process exited with code 1

Steps to Reproduce

Open Claude Code on Windows.

Run /logout.

Run /login and select Anthropic Console.

Complete the OAuth flow in the browser.

Return to Claude Code.

Type any message → error occurs.

Check API keys on console.anthropic.com
→ new key is created each time.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.56

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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