published fresh until

Claude Code created a file named 'nul' on Windows: how do I delete it?

Summary As of November 19, 2026, Claude Code lists a prevention fix for literal nul files created by CMD-style redirection in Git Bash. Existing files still need cleanup; the relevant release is 2.1.69

Not for the Windows desktop update file-lock error; see claude-code-desktop-windows-relaunch-file-lock

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

As of November 19, 2026, 2.1.69 lists a fix for 2>nul in Git Bash. Do first: update Claude Code, then handle any existing file using the cleanup options below.

The problem

On Windows, Claude Code sometimes leaves a regular file named nul in the working folder. nul is a reserved device name on Windows, so Explorer and many tools cannot delete or even stat it, and it can break git add, commit-message generators and folder deletes. The GitHub issue was opened on 2025-08-01 by rweijnen (version 1.0.62). As of November 19, 2026, the issue is closed and automatically locked.

Likely cause

The reporter guessed Unix-style null redirection was being turned into a Windows one. The release notes list a fix for literal nul file creation on Windows from CMD-style 2>nul redirection in Git Bash. One commenter found a leftover nul file holding the text of a failed Python one-liner that Claude had run while mapping a project. The reporter's guess and the commenter's report are user observations, not a maintainer diagnosis.

Maintainer response

A maintainer (ant-kurt) wrote on 2026-02-13 that adjustments were made in 2.1.42 and asked people to say if it still occurs. Commenters still reported the file on 2.1.63. The later 2.1.69 release notes explicitly name a fix for literal nul file creation from CMD-style 2>nul redirection in Git Bash. That is a specific prevention fix, not a cleanup command for files already present.

Ways to delete the file (commenter-reported)

  • Git Bash or WSL. A commenter said rm nul in Git Bash removes it; another used WSL for the same.
  • Extended-length path prefix. The reporter said prefixing the full path with the extended-length prefix, which is two backslashes, a question mark and a backslash, lets Windows tools delete it. Two commenters posted scripts that use that prefix in bulk; they are third-party code, so read them before running.
  • Archive trick. One commenter added the file to a 7-Zip archive with the option to delete files after compressing. They called it dumb but said it worked.
  • Ask Claude Code. One commenter said asking Claude Code to remove the file it created worked.
  • Third-party tool. A commenter also shared a small Explorer context-menu tool for deleting folders that contain nul. It is third-party code, outside the deletion methods described here.

Preventing the commit problem

A commenter said they added nul to .gitignore and had no issues since; another worried it might affect Windows and did not confirm. Writing an OS reminder in CLAUDE.md did not stop it for at least one commenter. Others posted pre-execution hooks that rewrite shell commands; those are third-party scripts that change what Claude runs, so review them first. A commenter also argued the real cause is Claude mixing cmd, PowerShell and bash on Windows, which is an opinion.

Status

Reports after the 2.1.42 adjustment do not by themselves establish a failure of the later 2.1.69 fix. The thread is locked, so recurring cases on a current version need a new issue. Clean up the file, update, and include the shell and redirection command if it returns.

Sources

Started from a post by @rweijnen, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Code created a file named 'nul' on Windows: how do I delete it?
Summary: As of November 19, 2026, Claude Code lists a prevention fix for literal nul files created by CMD-style redirection in Git Bash. Existing files still need cleanup; the relevant release is `2.1.69`
Copy for agent
get the whatworks thread claude-code-windows-nul-file-breaks-git-how-to-delete and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-windows-nul-file-breaks-git-how-to-delete
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks