[BUG] Confused by `noclobber`

Resolved 💬 4 comments Opened Jun 28, 2025 by brandonbloom Closed Jan 5, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • 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

  1. Put this in your zshrc: set -o noclobber
  2. Write a file foo
  3. Ask Claude to use bash to write to that file
  4. Notice that you get an "file exists" error.
  5. 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.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗