[BUG] Claude Code fails to login via the Anthropic Console in VSCode when using devcontainers
Resolved 💬 4 comments Opened Dec 18, 2025 by mikeengland Closed Jan 4, 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?
I am trying to use the Claude Code extension in VSCode with a devcontainer. When I try and login via /login, it prompts me to select a login method. When I select Anthropic Console, I authenticate, however when I try and use the Claude Code extension window it fails with Invalid API key · Please run /login. This happens in a loop. Note, this doesn't happen for me when not using a devcontainer.json setup.
What Should Happen?
I should be able to login to Claude Code with /login from within the container setup by the devcontainer.json file.
Error Messages/Logs
Here is what I see in the VSCode output window:
2025-12-18 21:31:10.956 [info] From claude: 2025-12-18T21:31:10.956Z [DEBUG] Getting matching hook commands for UserPromptSubmit with query: undefined
2025-12-18T21:31:10.956Z [DEBUG] Found 0 hook matchers in settings
2025-12-18T21:31:10.956Z [DEBUG] Matched 0 unique hooks for query "no match query" (0 before deduplication)
2025-12-18 21:31:10.967 [info] From claude: 2025-12-18T21:31:10.966Z [DEBUG] FileHistory: Making snapshot for message 6e3e397b-d1e9-4974-a80c-89081f7cf5a0
2025-12-18 21:31:10.967 [info] From claude: 2025-12-18T21:31:10.967Z [DEBUG] FileHistory: Added snapshot for 6e3e397b-d1e9-4974-a80c-89081f7cf5a0, tracking 0 files
2025-12-18 21:31:10.986 [info] From claude: 2025-12-18T21:31:10.986Z [ERROR] Error streaming, falling back to non-streaming mode: 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
2025-12-18 21:31:10.994 [info] From claude: 2025-12-18T21:31:10.989Z [ERROR] Error in non-streaming fallback: 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
2025-12-18T21:31:10.989Z [ERROR] "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 validateHeaders (/$bunfs/root/claude:811:1013)\n at buildHeaders (/$bunfs/root/claude:811:8516)\n at async buildRequest (/$bunfs/root/claude:811:7582)\n at async makeRequest (/$bunfs/root/claude:811:3410)\n at processTicksAndRejections (native:7:39)"
Steps to Reproduce
- Setup a new project with a .devcontainer/devcontainer.json file e.g.:
{
"name": "Python Dev Container",
"build": {
"dockerfile": "../Dockerfile"
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"anthropic.claude-code"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.formatting.provider": "black"
}
}
},
"forwardPorts": [8000],
"postCreateCommand": "pip install -r requirements.txt",
"remoteUser": "root"
}
- Open Claude Code extension
- Try and login via
/login
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.72 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗