DEBUG mode auto-enabled from .env (regression of #346)

Resolved 💬 3 comments Opened Nov 4, 2025 by tzonghao Closed Nov 7, 2025

Description

Claude Code v2.0.32 automatically enables debug mode when it finds DEBUG=True in a project's .env file. This appears to be a regression of issue #346, which was marked as fixed in v0.2.54.

Impact

This creates poor user experience because:

  1. Many web frameworks (Django, Flask, Rails, etc.) use DEBUG=True in .env for their own application debugging
  2. Claude Code inherits this unrelated setting and enables its own debug logging
  3. Debug mode adds performance overhead and verbose logging that users didn't request
  4. Users are confused why Claude behaves differently across projects based on unrelated environment variables

Steps to Reproduce

  1. Create a project with .env file containing DEBUG=True (or DEBUG=true)
  2. Run claude in that directory
  3. Observe: Debug mode is automatically enabled with message:

``
Debug mode enabled
Logging to: ~/.claude/debug/<session-id>.txt
``

Expected Behavior

As stated in #346: "We shouldn't be touching that file." Claude Code should not read or respect .env files, especially not environment variables intended for other applications.

Environment

  • Claude Code Version: 2.0.32
  • Platform: macOS (Darwin 25.0.0)
  • Related Issues: #346, #601

Workaround

Currently using: DEBUG=False claude to override the .env setting.

Suggestion

Consider using a Claude-specific environment variable like CLAUDE_DEBUG or CLAUDE_CODE_DEBUG instead of the generic DEBUG variable to avoid conflicts with application-level debug flags.

View original on GitHub ↗

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