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
- Navigate to a directory (e.g.,
/project/crates/foo) - Rename that directory via
git mvor other means to/project/crates/bar - Attempt any Bash command
Expected behavior
- Tool detects invalid cwd and resets to parent or
$HOME - Or allows
cdcommands 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
- Graceful cwd recovery when path no longer exists
- Verify file existence before Edit operations on paths that were just renamed
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗