[BUG] When the Bash tool's internal working directory is deleted (e.g., during file reorganization)

Resolved 💬 2 comments Opened Jan 28, 2026 by Zegabit Closed Jan 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Description:
When the Bash tool's internal working directory is deleted (e.g., during file reorganization), all subsequent bash commands fail with exit
code 1 and no output. The shell becomes completely non-functional until the deleted directory is recreated.

Steps to reproduce:

  1. Run cd /some/subdirectory via Bash tool
  2. Delete that directory (via rmdir or file moves)
  3. Try any bash command - even echo test or ls /
  4. All commands fail with exit code 1, no error message

Expected behavior:

  • Shell should fall back to a valid directory (e.g., project root)
  • Or provide a clear error message about invalid CWD

Actual behavior:

  • Silent failure on all commands
  • No indication of what's wrong
  • Only fix is recreating the deleted directory

Workaround:
Recreate the deleted directory, then cd to a valid location.

What Should Happen?

Expected behavior:

Shell should fall back to a valid directory (e.g., project root)
Or provide a clear error message about invalid CWD

Error Messages/Logs

Error: Exit code 1

Steps to Reproduce

Steps to reproduce:

  1. Run cd /some/subdirectory via Bash tool
  2. Delete that directory (via rmdir or file moves)
  3. Try any bash command - even echo test or ls /
  4. All commands fail with exit code 1, no error message

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.20 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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