[BUG] Windows: Creates literal "nul" files instead of discarding output to NUL device

Resolved 💬 4 comments Opened Jan 24, 2026 by jochem25 Closed Feb 13, 2026

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?

Claude Code creates literal files named nul in the working directory on Windows, instead of discarding output to the Windows NUL device.

This causes multiple issues:

  1. File cannot be deleted normally - Windows Explorer and standard del commands fail because "nul" is a reserved name
  2. Requires workaround to delete - Must use \\?\ prefix: [System.IO.File]::Delete("\\?\C:\path\to\nul")

Root cause hypothesis:
Somewhere in Claude Code or its dependencies, output is being redirected to nul in a way that creates a literal file instead of using the Windows NUL device. This may happen when running inside Git Bash but executing Windows commands.

What Should Happen?

When Claude Code or its subprocesses redirect output to nul (e.g., command > nul or command 2>nul), the output should be discarded via the Windows NUL device, similar to /dev/null on Linux.

No literal file named "nul" should ever be created in the working directory.

Error Messages/Logs

Steps to Reproduce

  1. Start Claude Code on Windows: claude
  2. Work on a project (exact trigger unclear, but happens during normal usage)
  3. Check working directory for a file literally named nul

Note: The exact steps to trigger this are unclear - it happens intermittently during normal Claude Code usage on Windows.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.19 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

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