[BUG] Environment variables defined in Local Settings are ignored if any Environment Variables are defined in Managed Settings
Resolved 💬 3 comments Opened May 20, 2026 by burkematthew Closed May 24, 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 I have a managed settings file defined with an env block, such as below:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_METRIC_EXPORT_INTERVAL": "60000",
"CLAUDE_CODE_USE_BEDROCK": "1",
"AWS_PROFILE": "bedrock",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "us.anthropic.claude-sonnet-4-6"
}
}
if I then have a local settings file with an env block, such as below:
"env": {
"OTEL_RESOURCE_ATTRIBUTES": "user.email=<my email>,user.name=Matthew"
},
any environment variables defined in the local settings file are ignored. Effectively, the env blocks do not merge.
What Should Happen?
Keys in the managed settings file should take precedent. But if there are nested keys in the env block, then so long as the nested key doesn't exist in the managed settings block, it should be respected and used.
Error Messages/Logs
Steps to Reproduce
- Create a managed settings file at
/Library/Application\ Support/ClaudeCode/managed-settings.jsonwith the following block:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_METRIC_EXPORT_INTERVAL": "60000",
"CLAUDE_CODE_USE_BEDROCK": "1",
"AWS_PROFILE": "bedrock",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "us.anthropic.claude-sonnet-4-6"
}
}
- In your local settings file, add the following env block:
{
"env": {
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "us.anthropic.claude-haiku-4-5-20251001-v1:0"
}
}
- Restart Claude.
- The default haiku model defined in your local settings file will not be respected.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.145
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗