DEBUG mode auto-enabled from .env (regression of #346)
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:
- Many web frameworks (Django, Flask, Rails, etc.) use
DEBUG=Truein.envfor their own application debugging - Claude Code inherits this unrelated setting and enables its own debug logging
- Debug mode adds performance overhead and verbose logging that users didn't request
- Users are confused why Claude behaves differently across projects based on unrelated environment variables
Steps to Reproduce
- Create a project with
.envfile containingDEBUG=True(orDEBUG=true) - Run
claudein that directory - 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗