Skip to content

[BUG] Environment Variables No Longer Override settings.json in v2.0.1 #8500

Closed as not planned

Description

@siraht

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

After updating to Claude Code v2.0.1 from 1.x, environment variables declared inline with the claude command are no longer overriding the configuration values set in ~/.claude/settings.json. This is a regression from v1.x behavior where environment variables had proper precedence.

What Should Happen?

When running:

ANTHROPIC_BASE_URL=http://localhost:8080 claude

The ANTHROPIC_BASE_URL should be set to http://localhost:8080 for that specific invocation, overriding any value in ~/.claude/settings.json.

Error Messages/Logs

Steps to Reproduce

Run ANTHROPIC_BASE_URL=http://localhost:8080 claude and see what happens?

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

1.x

Claude Code Version

2.0.1

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Warp

Additional Information

  • Standard environment variable behavior in bash works correctly (verified with ANTHROPIC_BASE_URL=http://localhost:8080 printenv ANTHROPIC_BASE_URL)
  • The issue affects all environment variables in the settings.json env object, not just ANTHROPIC_BASE_URL

Activity

  1. changed the title [-][BUG][/-] [+][BUG] Environment Variables No Longer Override settings.json in v2.0.1[/+] on Sep 30, 2025
  2. github-actions commented on Sep 30, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] Custom endpoint settings.json regression #7452
    2. [BUG] Inline thinking output with MAX_THINKING_TOKENS environment variable set no longer appears automatically #8380
    3. [BUG] CLAUDE_CODE_API_KEY_HELPER_TTL_MS not working from settings.json #7660

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  3. gardner commented on Oct 6, 2025

    @gardner

    This is still an issue.

  4. kierr commented on Oct 27, 2025

    @kierr

    This is driving me insane

    CLAUDE_CODE_DONT_INHERIT_ENV already existed as an undocumented env var, but changing that doesn't help either.

    The best solution for now is to use claude --settings ~/.claude/settings.alt.json but it's hardly as flexible as env vars being respected.

    Using a settings file without env set, and trying to add inline ENV, doesn't work. Nor does --setting-sources scoping.

    Using --settings with json does not override the settings file either.

    I suspect this was done in some effort to avoid the ability of overriding enterprise (forced) settings.

  5. github-actions commented on Dec 8, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  6. github-actions commented on Jan 10, 2026

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  7. github-actions commented on Jan 18, 2026

    @github-actions

    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.

  8. locked as resolved and limited conversation to collaborators on Jan 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions