[BUG] claudeCode.environmentVariables are not applied in WSL (Remote) environment
Status Fixed / completed
Reported on v2.1.81
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 6 comments · opened Mar 23, 2026 · closed Mar 25, 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?
When using VS Code in a WSL (Windows Subsystem for Linux) remote environment, the environment variables defined in claudeCode.environmentVariables inside settings.json are completely ignored by the extension. The connection fails.
However, if I manually export the same variables directly in the WSL terminal, the extension successfully connects. This indicates that the extension's environment variable injection logic is failing specifically under the WSL/Remote context.
What Should Happen?
The extension should properly read claudeCode.environmentVariables from the remote settings.json and inject them into the extension's process context in WSL, just as it does in the local Windows environment.
Error Messages/Logs
Steps to Reproduce
- Open VS Code and connect to a WSL environment.
- Open the Remote
settings.json(WSL: Ubuntu). - Add the following configuration:
"claudeCode.environmentVariables": [
{
"key": "ANTHROPIC_BASE_URL",
"value": "https://xxx.xx"
},
{
"key": "ANTHROPIC_API_KEY",
"value": "xx-xxx-..." // Redacted for security
}
]
4. Attempt to use the extension. Result: Connection fails / Timeout.
5. Workaround: Open the integrated WSL terminal and run:
export ANTHROPIC_BASE_URL="https://xxx.xx"
export ANTHROPIC_API_KEY="xx-xxx-..."
6. Attempt to use the extension again. Result: Connects successfully.
### Claude Model
None
### Is this a regression?
I don't know
### Last Working Version
_No response_
### Claude Code Version
2.1.81
### Platform
Other
### Operating System
Windows
### Terminal/Shell
VS Code integrated terminal
### Additional Information
_No response_
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
No, this is not a duplicate.
The issues suggested by the bot are fundamentally different from this bug:
#34141 is related to OAuth redirect failures in Docker Compose devcontainers. My issue does not involve OAuth or Docker.
#30538 and #34888 are about the extension specifically ignoring the CLAUDE_CONFIG_DIR variable for multi-profile setups.
My issue is specifically about the VS Code setting "claudeCode.environmentVariables" failing to inject ANY variables (like ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY) into the extension's process when running within a WSL (Remote) context. The variables work fine when manually exported in the WSL terminal.
This is a WSL remote-context injection bug, not an XDG/Config-dir or OAuth bug. Please keep this issue open.
"Hi team! Since I've already set up the WSL environment and isolated the root cause, I'd love to take a stab at fixing this. Could you please assign it to me?"
/assign
I found that the key in the JSON configuration file was wrongly written."key" should be "name".so close
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.