[BUG] sandbox silently fails despite `failIfUnavailable` set to `true` in VSCode (Cursor) terminal

Resolved 💬 3 comments Opened Apr 10, 2026 by ozydingo Closed May 24, 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?

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

  1. Create settings.json
{
  "sandbox": {
    "enabled": true,
    "allowUnsandboxedCommands": false,
    "failIfUnavailable": true,
    "autoAllowBashIfSandboxed": true,
    "filesystem": {
      "denyWrite": ["./foo"]
    }
  }
}
  1. Run mkdir foo
  1. Open Cursor, open terminal panel. Run
claude -p 'Run `touch foo/file`'

Observe: claude succeeds, write succeeds.

  1. 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 hello

View original on GitHub ↗

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