[BUG] Claude Code randomly nukes claude.json in wsl
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.83
- Operating System: Windows 11
- Terminal: Windows terminal / wsl
Bug Description
I use Claude Code on Windows thru wsl. For organizational purposes, I symlink its config to a dir on the host system:
ln -s /mnt/d/AppData/claude /home/xxx/.claude
ln -s /mnt/d/AppData/claude/claude.json /home/xxx/.claude.json
This works fine 99% of the time. However, occasionally the first time I launch Claude Code after a fresh system reboot, it will show me the initial setup, and it will have nuked / overwritten claude.json with an empty/default config. When this happens I can just quit Claude Code, restore the previous claude.json, and launch again - then it works.
I suspect this has to do with permission wackiness with how WSL maps files stored on NTFS to Linux permissions - when viewing files stored on NTFS thru WSL, I've occasionally noticed permissions spontaneously changing, i.e. just after launching wsl they have no permissions, then moments later they change to 777. My guess is that Claude tries to read claude.json, fails to do so, and the - this is the issue - it nukes whatever's there and just creates default.
It should NOT under any circumstances nuke the claude.json, but if there's some issue, it should display an error message and refuse to start (or some other fallback that doesn't result in data loss).
Steps to Reproduce
- Setup Claude Code on WSL
- Move its config to the locations you use in the next 2 steps
- ln -s /mnt/d/some/folder/on/windows/ntfs /home/xxx/.claude
- ln -s /mnt/d/some/folder/on/windows/nftfs/claude.json /home/xxx/.claude.json
- Reboot Windows
- Start WSL
- Launch Claude
- Most of the time it will work (with its prior config). Occasionally it will present as if it's never been setup, and claude.json will have been overwritten with a default config (data loss)
Expected Behavior
If Claude has some issue accessing its config, it should under no circumstances result in data loss
Actual Behavior
Claude nukes its config
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗