[BUG] Claude silents fails to enter sandbox in non-writable directory

Resolved 💬 2 comments Opened Apr 2, 2026 by ejh3 Closed Apr 30, 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?

Version: v2.1.90

OS: Linux (RHEL 9, kernel 5.10)

To reproduce:

mkdir -p /tmp/cc-sandbox-test && chmod 555 /tmp/cc-sandbox-test
cd /tmp/cc-sandbox-test && claude --debug

Full session transcript (identifiable info redacted):

╭─── Claude Code v2.1.90 ────────────────────────────────────────────────────╮
│                                                                             │
│   Sonnet 4.6 (1M context) · API Usage Billing                              │
│              /tmp/cc-sandbox-test                                           │
╰─────────────────────────────────────────────────────────────────────────────╯

  Debug mode enabled
  Logging to: /home/user/.claude/debug/<session-id>.txt

! rg 'failIf' ~/.claude/settings.json
  ⎿      "failIfUnavailable": true

! ls -lah /tmp/cc-sandbox-test
  ⎿  total 528K
     dr-xr-xr-x   2 user user 4.0K Apr  1 .
     drwxrwxrwt 293 root root 520K Apr  1 ..

❯ /sandbox
  ⎿  ✓ Sandbox enabled with auto-allow for bash commands

❯ Run a complex bash command with substitutions and logical operators which
  would normally not be allowed if you were outside of sandbox mode

● Bash(echo "Date: $(date)" && echo "Files in /tmp: $(ls /tmp | wc -l)" || echo "Something failed")
  ⎿  Date: <date>
     Files in /tmp: 11150

● Sandbox mode is working — the command ran with $() substitutions and
  &&/|| operators without any permission prompts.

! echo "There was a permission prompt actually"
  ⎿  There was a permission prompt actually

! rg 'mkdir' /home/user/.claude/debug/<session-id>.txt
  ⎿  [ERROR] Error: Error: Failed to read raw settings from
     /tmp/cc-sandbox-test/.claude/settings.local.json: Error: EACCES:
     permission denied, mkdir '/tmp/cc-sandbox-test/.claude'

❯ /sandbox

────────────────────────────────────────────────────────────────────────────
  Sandbox:  Mode   Overrides   Config

  Configure Mode:

    1. Sandbox BashTool, with auto-allow
    2. Sandbox BashTool, with regular permissions
    3. No Sandbox (current)

  Auto-allow mode: Commands will try to run in the sandbox automatically,
  and attempts to run outside of the sandbox fallback to regular permissions.
  Explicit ask/deny rules are always respected.

  Learn more: code.claude.com/docs/en/sandboxing

Root cause (from debug log):

Claude Code tries to mkdir the project-level .claude directory on startup. When the working directory is not writable (e.g. owned by root, or chmod 555), this fails with EACCES, which causes sandbox initialization to silently abort even though the UI reports it as enabled.

What Should Happen?

At least surface an error saying why the sandbox could not be enabled. In my case I have "failIfUnavailable": true so this is especially egregious.

Error Messages/Logs

2026-04-02T00:41:17.220Z [ERROR] Error: Error: Failed to read raw settings from /tmp/cc-sandbox-test/.claude/settings.local.json: Error: EACCES: permission denied, mkdir '/tmp/cc-sandbox-test/.claude'
    at v6 (/$bunfs/root/src/entrypoints/cli.js:185:80)
    at CI4 (/$bunfs/root/src/entrypoints/cli.js:594:5777)
    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:6613:14411)
    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1575:49091)
    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1503:62118)
    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:528:4509)
    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:528:3682)
    at emit (/$bunfs/root/src/entrypoints/cli.js:468:16211)
    at GE4 (/$bunfs/root/src/entrypoints/cli.js:500:1368)
    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:477:110821)

Steps to Reproduce

  1. mkdir -p /tmp/cc-sandbox-test && chmod 555 /tmp/cc-sandbox-test
  2. cd /tmp/cc-sandbox-test && claude
  3. Run /sandbox — observe "✓ Sandbox enabled"
  4. Run /sandbox again — observe "No Sandbox (current)"

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.90

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

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