What's Wrong?
The Claude Code VS Code extension (v2.1.92) constantly shows 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."}} and cannot authenticate at all.
This has been happening for multiple days. Even after:
- Complete VS Code uninstall and fresh reinstall
- Clearing all keychain entries for "Claude Code-credentials"
- Running
claude auth login to get a fresh OAuth token
- The CLI works fine (
claude -p "test" returns OK with the keychain token)
The VS Code extension still shows 401 immediately after loading.
Key finding: The CLI binary works correctly using the keychain token. The VS Code extension does NOT work even with the same valid token in keychain.
What Should Happen?
VS Code extension should authenticate successfully using the valid OAuth token stored in the macOS keychain, just like the CLI does.
Error Messages/Logs
Failed to authenticate. API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."}}
[WARN] [keychain] readAsync failed; serving stale cache
Request IDs for server-side lookup:
- req_011CZjYvFh6CuVLGKfCM7Huc
- req_011CZjaNANwkTHb1RoY6VUkc
- req_011CZjhExmKMUXhbRkUzfMXf
- req_011CZjhWVNz7Q23L9FcBHucQ
Steps to Reproduce
- Open VS Code with Claude Code extension installed (v2.1.92)
- Open the Claude Code panel
- Immediately see "Failed to authenticate. API Error: 401 OAuth token has expired"
- This happens even immediately after running
claude auth login
- CLI works:
env -u CLAUDE_CODE_OAUTH_TOKEN claude -p "test" → "OK"
- VS Code extension always returns 401
Additional Information
Environment:
- OS: macOS 12.7.6 (Monterey)
- VS Code: 1.114.0
- Claude Code extension: v2.1.92
- Claude Desktop: also running simultaneously
Root cause hypothesis:
CLAUDE_CODE_OAUTH_TOKEN env var is set by Claude Desktop app with an expired token. When VS Code inherits this env var, the CLI binary uses this expired token instead of the valid keychain token.
Also: [keychain] readAsync failed; serving stale cache suggests keychain reads may fail silently in VS Code context on macOS 12 Monterey.
This issue has persisted for multiple days. Please follow up — I would appreciate a response from the Anthropic team regarding compensation for this ongoing service disruption.
What's Wrong?
The Claude Code VS Code extension (v2.1.92) constantly shows
401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."}}and cannot authenticate at all.This has been happening for multiple days. Even after:
claude auth loginto get a fresh OAuth tokenclaude -p "test"returns OK with the keychain token)The VS Code extension still shows 401 immediately after loading.
Key finding: The CLI binary works correctly using the keychain token. The VS Code extension does NOT work even with the same valid token in keychain.
What Should Happen?
VS Code extension should authenticate successfully using the valid OAuth token stored in the macOS keychain, just like the CLI does.
Error Messages/Logs
Request IDs for server-side lookup:
Steps to Reproduce
claude auth loginenv -u CLAUDE_CODE_OAUTH_TOKEN claude -p "test"→ "OK"Additional Information
Environment:
Root cause hypothesis:
CLAUDE_CODE_OAUTH_TOKENenv var is set by Claude Desktop app with an expired token. When VS Code inherits this env var, the CLI binary uses this expired token instead of the valid keychain token.Also:
[keychain] readAsync failed; serving stale cachesuggests keychain reads may fail silently in VS Code context on macOS 12 Monterey.This issue has persisted for multiple days. Please follow up — I would appreciate a response from the Anthropic team regarding compensation for this ongoing service disruption.