[BUG] env variables not taking effect after the first query

Resolved 💬 4 comments Opened Dec 24, 2025 by yf-yang Closed Jan 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?

``` shell
ANTHROPIC_BASE_URL=xxx ANTHROPIC_AUTH_TOKEN=xxx claude hi # worked

During the above session, if I type another prompt, then got connection error 520, it seems the env variable is not working
Instead,
``` shell
ANTHROPIC_BASE_URL=xxx ANTHROPIC_AUTH_TOKEN=xxx claude

If I use the command above to directly start a new session, then the prompt will always fail.

I got this problem within a ubuntu container. Both cursor terminal + /bin/zsh and directly attach the container with /bin/bash does not work, so I think it is not a shell problem.

At least starting from v2.0.37 it does not work. However when I downgrade to v2.0.25 there is no such problems. I didn't try other versions in between.
When using latest version v2.0.75 directly in my macos warp terminal, it also works without any issue.

What Should Happen?

claude should use those env variables to connect

Error Messages/Logs

Steps to Reproduce

``` shell

Run it within a container

ANTHROPIC_BASE_URL=xxx ANTHROPIC_AUTH_TOKEN=xxx claude

Then type prompt and it fails to connect


### Claude Model

Sonnet (default)

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

2.0.25

### Claude Code Version

2.0.75 (at least 2.0.37 is not working)

### Platform

Anthropic API

### Operating System

Ubuntu/Debian Linux

### Terminal/Shell

Cursor

### Additional Information

cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.3 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗