[BUG] debug mode is sensitive to the env var DEBUG which is too generic and very likely to be declared for the codebase claude-code is used for
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?
The env var DEBUG is a popular name for application debugging and tends to be set in dev environments. IMO, dev tools relying on the same in released software is bad design.
I had reported something similar for the gh-cli tool and there is a lot more reasoning there.
What Should Happen?
Like the gh-cli folk, please do reconsider deprecating this in favour for a more specifically scoped env var name (eg: CC_DEBUG), or a specific value (eg: DEBUG=cc-debug) or remove it completely since the cli already has a --debug option.
Error Messages/Logs
Steps to Reproduce
- Change into a repo for an app that uses
DEBUG=trueenv var to enable debugging the app. - export DEBUG=True and start the app
- launch
claude - claude will startup with debug enabled
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.276
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
https://github.com/user-attachments/assets/52dca25b-4c27-4d76-8626-db21e09f4089
This has been reported multiple times:
- https://github.com/anthropics/claude-code/issues/346
- https://github.com/anthropics/claude-code/issues/11015
- https://github.com/anthropics/claude-code/issues/24
- https://github.com/anthropics/claude-code/issues/70576
But every time the report has been closed without an actual resolution.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗