Skip to content

Unintended Debug Logging Triggered by .env File #346

Closed

Description

@stevenlafl

Bug Description
If a .env file in the location where you run claude contains "DEBUG=true" then it causes Anthropic HTTP requests to be visible with debug information. That behavior is not desired.

Environment Info

  • Platform: linux
  • Terminal: konsole
  • Version: 0.2.31
  • Feedback ID: 819d6c2b-c9cc-40c2-90c5-931ed7ce0d15

I understand there is a .claudeignore or claude config add ignorePatterns .env but this prevents that data from being loaded into Claude, not prevent the CLI from reading it.

If possible, perhaps Claude's dotenv should not load the DEBUG variable and instead defer that to a command-line argument if it is desired.

Activity

  1. self-assigned this
    on Mar 5, 2025
  2. ashwin-ant commented on Mar 5, 2025

    @ashwin-ant
    Collaborator

    This is a behavior of our SDK: https://github.com/anthropics/anthropic-sdk-typescript?tab=readme-ov-file#logging-and-middleware. We'll see what we can do here to suppress this.

  3. richbradshaw commented on Mar 12, 2025

    @richbradshaw

    Confirming that this is really annoying - I have multiple projects that have a .env with DEBUG=true - so this is a real pita!

  4. wolffiex commented on Mar 25, 2025

    @wolffiex
    Collaborator

    Sorry about this. We shouldn't be touching that file. Should be fixed in 0.2.54

  5. luis-alvarado commented on Apr 23, 2025

    @luis-alvarado

    Seeing this in Claude Code v0.2.79: same issue as reported above, have an .env file with DEBUG=true in the same working directory where Claude Code is running.

    Can confirm the issue goes away if the .env file does not contain DEBUG=true.

  6. github-actions commented on Aug 9, 2025

    @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.

  7. locked as resolved and limited conversation to collaborators on Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions