[BUG] Claude Code keeps printing out env var secrets verbatim instead of referring them as $ENV_VAR

Resolved 💬 3 comments Opened May 4, 2026 by xinbenlv Closed May 8, 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?

Recently, when I use Claude Code, it repeatedly exposed env secrets from env in conversation by printing them out verbatim - which means it can be leaked to many places. I had to conduct secret rotations way too many times. Despite there were memory, skill and AGENTS.md, and settings.json deny list guardrail to prevent it from making such mistake, I've seen it does so anyway.

I consider this is a severe bug that needs to get attention. @claudeai

My environment: Claude Code v2.1.126, Opus 4.7 (1M context) with high effort · Claude Max

Until this bug is fixed, my usage of ClaudeCode subscription is effectively blocked.

What Should Happen?

The env var secrets should be referred to as $ENV_VAR rather than printing it verbatim

Error Messages/Logs

Steps to Reproduce

Try ask Claude Code to refer a secret when running a script

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.126

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

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