[BUG] Sandbox blocks git checkout / worktree add on repos tracking .vscode/ — intended?
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
Trying to git worktree add from a monorepo that tracks .vscode/settings.json. The sandbox denies writing .vscode/settings.json during checkout; the worktree add fails mid-operation, leaving a stale branch + worktree registration that requires git worktree prune + git branch -D to clean up.
The block isn't in any visible settings file — it's hardcoded in the binary. Is this intended? If blocking writes to tracked .vscode/* / .idea/* (common in shared monorepos that standardize format/lint settings) is a deliberate security tradeoff, that's worth documenting + providing an opt-out for. If unintended, explicit sandbox.filesystem.allowWrite entries should win over the hardcoded list so git checkout works on any user-allowlisted repo.
What Should Happen?
git checkout / git worktree add should succeed on any repo under a user-allowlisted allowWrite root, regardless of whether the repo tracks .vscode/*.
Error Messages/Logs
operation not permitted: /Users/xida/monorepo/t/.vscode/x.json
Steps to Reproduce
~/.claude/settings.json:
``json``
{"sandbox": {"enabled": true, "filesystem": {"allowWrite": ["~/monorepo/"]}}}
- Have a repo under
~/monorepo/that tracks.vscode/settings.json. git -C ~/monorepo/main worktree add ../feature-x -b feature-x main→ fails mid-checkout; branch + registration created but directory incomplete. Recovery:git worktree prune+git branch -D feature-x.
Narrow repro (sandboxed Bash):
$ printf '{}' > ~/monorepo/t/.vscode/x # operation not permitted
$ printf '{}' > ~/monorepo/t/.idea/x # operation not permitted
$ printf '{}' > ~/monorepo/t/foo # ok
$ printf '{}' > ~/monorepo/t/.git/x # ok (not blocked)
Claude Model
Not applicable (sandbox behavior, not model-dependent)
Is this a regression?
I don't know
Claude Code Version
2.1.114
Platform
Anthropic API
Operating System
macOS (Darwin 24.6.0)
Terminal/Shell
iTerm2
Additional Information
v2.1.114 binary strings show .vscode, .idea hardcoded near the _SBX module, distinct from the home-dir-mapping dotfile set (.bashrc, .gitconfig, .mcp.json, …) discussed in #29316. Related: #29316, #50505.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗