claude-code
claude-code copied to clipboard
[BUG] Confused by `noclobber`
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version: 1.0.33 (Claude Code)
- Operating System: macOS 15.5 (24F74)
- Terminal: Terminal App
Bug Description
Claude is unaware of noclobber settings and then gets confused when trying to write files with bash like echo foo > already-existing.txt. It spins its wheels a bit trying to solve the issue. If told to use >! instead of >, he gets it right, but I have to remind him of this virtually every session.
Steps to Reproduce
- Put this in your zshrc:
set -o noclobber - Write a file foo
- Ask Claude to use bash to write to that file
- Notice that you get an "file exists" error.
- Notice Claude tries a few things and struggles to figure it out
Expected Behavior
Either Claude is aware of shell configuration and defaults to >! if necessary for the current configuration. Or, minimally, Claude recognizes file exists error and naturally knows about >! and tries again using that.
Actual Behavior
Claude spins his wheels until interrupted.
Additional Context
A workaround that seems to usually work is to add this to your CLAUDE.md:
- NOCLOBBER is enabled in the zsh config. You must use
>!to replace files.