VS Code Extension GUI Mode Ignores Bedrock Environment Configuration
VS Code Extension GUI Mode Ignores Bedrock Environment Configuration
Summary
The Claude Code VS Code extension GUI mode does not respect AWS Bedrock environment variables or Claude Code settings, resulting in "invalid model identifier" errors when using GovCloud or other non-default Bedrock configurations. Terminal mode works correctly.
Environment
- Claude Code Extension Version: 2.1.29
- VS Code Version: 1.96.x
- OS: macOS Darwin 25.2.0
- AWS Region: us-gov-west-1 (GovCloud)
Expected Behavior
When CLAUDE_CODE_USE_BEDROCK=1 and ANTHROPIC_MODEL=us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0 are configured, the GUI mode should use these settings to connect to AWS Bedrock with the specified model.
Actual Behavior
GUI mode ignores all Bedrock configuration and attempts to use us.anthropic.claude-sonnet-4-5-20250929-v1:0 (commercial prefix) instead of us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0 (GovCloud prefix), resulting in:
API Error (us.anthropic.claude-sonnet-4-5-20250929-v1:0): 400 The provided model identifier is invalid.
Steps to Reproduce
- Configure AWS Bedrock for GovCloud with the following environment variables:
``bash``
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_PROFILE=my-govcloud-profile
export AWS_REGION=us-gov-west-1
export ANTHROPIC_MODEL=us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0
- Open VS Code in the project directory
- Open Claude Code extension (GUI mode, not terminal mode)
- Attempt to send any message
- Observe the "invalid model identifier" error with wrong model prefix
Configuration Methods Attempted (All Failed for GUI Mode)
1. direnv (.envrc file)
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_PROFILE=my-govcloud-profile
export AWS_REGION=us-gov-west-1
export ANTHROPIC_MODEL=us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0
export CLAUDE_CODE_SUBAGENT_MODEL=us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0
export ANTHROPIC_SMALL_FAST_MODEL=us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0
Result: Works for integrated terminal, ignored by GUI
2. VS Code direnv extension (mkhl.direnv)
Installed and verified working - environment variables load correctly in terminal.
Result: GUI still uses wrong model
3. VS Code workspace settings (.vscode/settings.json)
{
"claudeCode.environmentVariables": [
{"name": "CLAUDE_CODE_USE_BEDROCK", "value": "1"},
{"name": "AWS_PROFILE", "value": "my-govcloud-profile"},
{"name": "AWS_REGION", "value": "us-gov-west-1"},
{"name": "ANTHROPIC_MODEL", "value": "us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0"},
{"name": "CLAUDE_CODE_SUBAGENT_MODEL", "value": "us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0"},
{"name": "ANTHROPIC_SMALL_FAST_MODEL", "value": "us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0"}
]
}
Result: Ignored by GUI (may only apply to terminal mode?)
4. Claude Code project settings (.claude/settings.json)
{
"env": {
"CLAUDE_CODE_USE_BEDROCK": "1",
"AWS_PROFILE": "my-govcloud-profile",
"AWS_REGION": "us-gov-west-1",
"ANTHROPIC_MODEL": "us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0",
"CLAUDE_CODE_SUBAGENT_MODEL": "us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0",
"ANTHROPIC_SMALL_FAST_MODEL": "us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0"
}
}
Result: Ignored by GUI
5. Claude Code local settings (.claude/settings.local.json)
Same env block as above added to existing settings.local.json.
Result: Ignored by GUI
6. Launching VS Code from terminal with env vars set
cd ~/Projects/MyProject # direnv activates
code . # Launch VS Code with inherited env
Result: GUI still uses wrong model
Workaround
Setting "claudeCode.useTerminal": true in .vscode/settings.json forces Claude to run in the integrated terminal, which correctly inherits direnv environment variables.
{
"claudeCode.useTerminal": true
}
This works but loses the GUI features.
Impact
- Users with multiple AWS profiles (commercial vs GovCloud) cannot use GUI mode
- Users with custom Bedrock configurations cannot use GUI mode
- The
claudeCode.environmentVariablessetting appears non-functional for GUI mode
Suggested Fix
The GUI mode should read environment configuration from:
claudeCode.environmentVariablesVS Code setting.claude/settings.local.jsonenv block.claude/settings.jsonenv block- Parent process environment variables
At minimum, documentation should clarify that GUI mode has limitations with Bedrock configuration.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗