[BUG] Deleting its CWD breaks its shell

Resolved 💬 2 comments Opened Feb 16, 2026 by hughesjs Closed Feb 16, 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?

When I ask CC to do something in a temp dir (like make a test project and check it can import my library), it then cleans up after itself.

That's great, that bit works.

Problem is, it deletes its CWD (the temp dir) and then completely breaks its shell and cannot recover until I exit CC and resume.

What Should Happen?

It should be able to recover its internal shell to a sensible state without restart, or will change its CWD before deleting the temp dir

Error Messages/Logs

Every shell command just fails with a 1 err code

Steps to Reproduce

  1. "Do x in a temp directory to check Y and then clean up after yourself"
  2. "Run some shell command"

Observe failure.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.42

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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