[BUG] [CRITICAL] Project Directory Deletion during background task conversion with Sonnet 4.6 1mln context
Resolved 💬 4 comments Opened Feb 27, 2026 by dtanow Closed Mar 27, 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?
│ 18:55:37 │ Sonnet 4.6 submits rm -rf command (foreground, NOT requesting background) │
├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 18:55:40 │ Claude Code auto-promotes command to background task bv29bchzl │
├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 18:55:40 – 18:57:36 │ 119 seconds of execution with zero output (117 progress entries) │
├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 18:57:37 │ Background task completes (exit code 0, output file: 0 bytes) │
├─────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ 18:57:37+ │ Every subsequent command fails: "Working directory sera no longer exists"
What Should Happen?
Claude should be careful with deleting entire project directories
Error Messages/Logs
Most Likely Root Cause
A bug in Claude Code v2.1.59's auto-background-promotion mechanism for bash commands. When the rm -rf command was automatically promoted from foreground to background execution, something in the path handling went wrong
The circumstantial evidence is strong:
- The previous session ran the same pattern (rm + df) in foreground → no issue
- This session's command was auto-promoted to background → entire directory deleted
- The execution duration matches deleting ~120GB, not 463MB
Steps to Reproduce
something like this:
collect the remaining my_config_v2 config batch #3 run from new vm and transfer to the local directory with the same structure as previous batches
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.59
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗