Bash tool becomes permanently stuck when cwd is renamed/deleted; no graceful recovery

Resolved 💬 3 comments Opened Jan 6, 2026 by klmurphy72 Closed Feb 19, 2026

When the Bash tool's current working directory is renamed or deleted, the tool becomes completely unusable - it cannot execute any commands, including cd to escape.

Steps to reproduce

  1. Navigate to a directory (e.g., /project/crates/foo)
  2. Rename that directory via git mv or other means to /project/crates/bar
  3. Attempt any Bash command

Expected behavior

  • Tool detects invalid cwd and resets to parent or $HOME
  • Or allows cd commands to run regardless of cwd state
  • Or warns and offers recovery options

Actual behavior

  • Every command fails with "Path does not exist"
  • No way to recover within the Bash tool
  • Must use Task agent as workaround

Secondary issue

When the rename command itself fails/errors, subsequent Edit tool calls to the new path may silently create new files rather than editing existing ones. This could cause:

  • Orphaned original files
  • Duplicate directories
  • Package name mismatches

Suggested fix

  1. Graceful cwd recovery when path no longer exists
  2. Verify file existence before Edit operations on paths that were just renamed

View original on GitHub ↗

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