Sandbox mode leaves read-only bind mounts that persist after disable
Problem
After running Claude Code with the default sandbox mode enabled, certain files get mounted as read-only via bind mounts (likely from the filesystem sandbox implementation). These mounts persist even after disabling sandbox with /sandbox, making it impossible to:
git checkout -- <file>(error: unable to unlink old file: Read-only file system)git stash(same error)git pull(same error, can't update the file)rm -f <file>(cannot remove: Read-only file system)git reset --hard(same)
The only recovery is restarting the entire Claude Code session, which loses all conversation context.
Reproduction
- Start Claude Code in a git repo with sandbox mode enabled (default)
- Edit a file that the sandbox has restricted (e.g.,
.github/workflows/pr.yml) - Switch branches or try to pull -- the file is now locked
- Run
/sandboxto disable -- files remain locked - All git operations involving that file fail permanently
Environment
- Claude Code CLI on Linux (Fedora/kernel 6.18)
- Terminal: Kitty
- Git repo with GitHub Actions workflows in
.github/
Impact
This is a workflow-breaking issue. During a session today, I:
- Could not switch branches
- Could not pull from remote
- Could not push a hotfix to main
- Could not stash or reset
- Had to abandon the session entirely
The sandbox filesystem restrictions should be fully reversible when disabled. Read-only bind mounts must be unmounted on /sandbox disable, not left as zombie mounts that corrupt the working tree.
Expected Behavior
/sandbox disable should:
- Unmount all sandbox bind mounts immediately
- Restore full read-write access to all files
- Allow normal git operations to resume
Alternatively, provide a way to completely opt out of sandbox mode at the project level (e.g., in .claude/settings.json) so it never activates.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗