cwd-cache failure persists session-wide after transient git mv race on macOS

Resolved 💬 2 comments Opened Apr 22, 2026 by duongntd99 Closed Apr 28, 2026

Summary

On macOS, when a git mv operation causes a transient inode race on the working directory, the Claude Code harness's cwd preflight (stats the cwd before every Bash call) caches the stat failure session-wide and never re-validates. Every subsequent Bash tool call in the session — including those from subagents spawned into the same session — dies before a shell is ever spawned with:

Working directory "/path/to/repo" no longer exists. Please restart Claude from an existing directory.

The directory is fine. Only the cached failure state is broken.

Key observations

  • The Read tool continues working throughout because it bypasses the cwd validator.
  • Subagents spawned after the wedge inherit the broken state and fail identically — dispatching them wastes tokens producing elaborate failure reports rather than doing work.
  • The only recovery is /exit + reopen — there is no in-session repair path.
  • The failure is non-deterministic: it requires a specific timing window during git mv on a path the harness is concurrently stat-ing.

Reproduction context

Triggered via git mv plans/proposed/<file> plans/approved/<file> inside a shell script invoked by a Bash tool call, on macOS 14.x (Apple Silicon). The harness cwd preflight races with the git mv inode rename.

Request

Add a re-validation pass (or a short retry with backoff) before caching a stat failure as permanent. A single failed stat on a path that is otherwise a valid, mounted directory should not tombstone the session.

Related

Similar class of issue to #29610 (permissionMode: bypassPermissions wedge).

View original on GitHub ↗

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