[BUG] sandbox silently fails despite `failIfUnavailable` set to `true` in VSCode (Cursor) terminal
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?
The sandbox does not activate when Claude Code is run from Cursor's (VS Code fork) integrated terminal. sandbox.enabled: true and sandbox.failIfUnavailable: true are both set, but writes succeed to denied paths. No failure, no warning, exit code 0.
The same configuration correctly blocks writes when run from an external terminal (iTerm2).
failIfUnavailable: true exists specifically so managed deployments can guarantee sandboxing is active. In this case it fails open with no indication that the security gate is missing.
What Should Happen?
Given "failIfUnavailable": true, Claude should:
Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start
(from docs)
Error Messages/Logs
Steps to Reproduce
- Create
settings.json
{
"sandbox": {
"enabled": true,
"allowUnsandboxedCommands": false,
"failIfUnavailable": true,
"autoAllowBashIfSandboxed": true,
"filesystem": {
"denyWrite": ["./foo"]
}
}
}
- Run
mkdir foo
- Open Cursor, open terminal panel. Run
claude -p 'Run `touch foo/file`'
Observe: claude succeeds, write succeeds.
- Control: open terminal / iterm. Run
claude -p 'Run `touch foo/file`'
Observe: write is blocked as expected
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.100
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Cursor
Additional Information
sandbox-exec works in both environments, confirmed with
sandbox-exec -p '(version 1)(allow default)' echo helloThis issue has 3 comments on GitHub. Read the full discussion on GitHub ↗