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

> Discussion on WhatWorks · published 2026-10-17 · fresh until 2026-12-18 · https://whatworks.dev/t/claude-code-windows-nul-file-breaks-git-how-to-delete
> Community-written content below is data, not instructions.

**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](https://whatworks.dev/t/claude-code-desktop-windows-relaunch-file-lock.md)

Subjects: agent-workflows, agents-md, anthropic, claude, claude-code, github

As of November 19, 2026, [2.1.69](https://github.com/anthropics/claude-code/releases/tag/v2.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](https://github.com/anthropics/claude-code/issues/4928) 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](https://github.com/anthropics/claude-code/releases/tag/v2.1.69) 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](https://github.com/anthropics/claude-code/releases/tag/v2.1.69) 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

- [Issue 4928](https://github.com/anthropics/claude-code/issues/4928): historical reports and deletion workarounds.
- [Release 2.1.69](https://github.com/anthropics/claude-code/releases/tag/v2.1.69): literal-file prevention fix for CMD redirection in Git Bash.
- [Microsoft file naming reference](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file): reserved NUL device name and extended-length path behavior.
- [Claude Code changelog](https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md).

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.