Files named 'nul' created on Windows instead of using NUL device

Resolved 💬 10 comments Opened Jan 13, 2026 by Rsrsys Closed Feb 13, 2026

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

View original on GitHub ↗

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