Files named 'nul' created on Windows instead of using NUL device
Description
Claude Code is creating actual files named nul in various directories on Windows. This appears to be a bug where code intended to write to the Windows NUL device (equivalent to /dev/null) instead creates a real file.
Evidence
Found 9 files named nul scattered across project directories after a couple days of irregular usage:
./ProjectA/nul
./ProjectB/SubfolderApi/nul
./ProjectB/nul
./ProjectB/WebApp/nul
./ProjectC/AdminWeb/nul
./ProjectD/nul
./ProjectE/ERP/nul
./nul
Probable cause
When running in a bash environment on Windows (Git Bash, WSL, etc.), writing to NUL or nul creates an actual file instead of discarding output as intended. The code should use /dev/null when in a bash context, or properly detect the environment.
Expected behavior
Output intended to be discarded should not create files.
Environment
- Platform: Windows 11
- Claude Code CLI (running in bash environment)
Workaround
Manual cleanup with: find . -name "nul" -type f -delete
it happened to me, so, +1
Happens all the time for long time :) Have to open VS Code to delete those.
+1, please fix this extremely annoying behaviour!
+1
+1
I've added this to my claude.md
## bash commands
don't pipe to /dev/nul. we run git bash on windows and it doesn't work.
I have the same issue and I am not able to delete those files
FWIW, some tips for deleting this file were shared in other threads: https://github.com/anthropics/claude-code/issues/4928
Consolidating issues
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.