[BUG] Windows: Creates reserved "nul" filename, breaks SharePoint/OneDrive sync
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?
## Description
Claude Code occasionally creates a file named nul in the working directory on Windows.
On Windows, nul is a Reserved Device Name, which causes:
- File cannot be deleted via Windows Explorer or standard commands
- OneDrive/SharePoint sync breaks completely
- Access denied to folders for all collaborators sharing the SharePoint directory
- Folder becomes inaccessible until the file is removed via WSL/Git Bash
## Environment
- OS: Windows 11
- Storage: OneDrive for Business / SharePoint synchronized folder
- Shell: Git Bash
## Steps to Reproduce
- Use Claude Code in a OneDrive/SharePoint synced folder
- Perform file creation/editing operations
- A
nulfile (~100 bytes) appears in the folder - SharePoint sync fails
- Collaborators can no longer access the folder
## Business Impact
Critical: Blocks shared folder access for entire team. Requires manual intervention via WSL or special tools to delete the file.
## Workaround
Delete via Git Bash or WSL:
```bash
rm "./nul"
Suggested Fix
Add filename validation to exclude Windows reserved names:
CON, PRN, AUX, NUL, COM1-COM9, LPT1-LPT9
What Should Happen?
Claude Code should never create files with Windows reserved names (NUL, CON, PRN, AUX, COM1-9, LPT1-9). The tool should validate filenames before creation and either:
- Skip/block creation of reserved names
- Automatically rename to a safe alternative (e.g., "_nul" or "nul_file")
Error Messages/Logs
Steps to Reproduce
- Open Claude Code on Windows in a OneDrive/SharePoint synced folder
- Ask Claude to perform file operations (create, edit, or list files)
- A file named "nul" (~100 bytes) is created in the directory
- OneDrive/SharePoint sync fails with error
- Collaborators get "Access Denied" when trying to open the folder
- File cannot be deleted via Explorer or standard "del" command
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
4-5-20251101
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗