anthropics / anthropics/claude-code
[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
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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](https://github.com/cli/cli/issues/5289) 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
```shell
```
### Steps to Reproduce
1. Change into a repo for an app that uses `DEBUG=true` env var to enable debugging the app.
2. export DEBUG=True and start the app
3. launch `claude`
4. 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:
1. https://github.com/anthropics/claude-code/issues/346
2. https://github.com/anthropics/claude-code/issues/11015
3. https://github.com/anthropics/claude-code/issues/24
4. https://github.com/anthropics/claude-code/issues/70576
But every time the report has been closed without an actual resolution.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the CLI's existing --debug behavior and the prior issues linked in the report, especially #346, #11015, #24, and #70576. Done means a generic DEBUG setting from the surrounding application no longer enables Claude Code debugging, while the supported debug option remains clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, shell
- Domain
- cli, developer-experience
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100