Sandbox tmpdir mechanism is opaque and fails silently

Resolved 💬 3 comments Opened Apr 6, 2026 by eqdmc-admin Closed Apr 10, 2026

Problem

The Bash sandbox creates temp directories at
/private/tmp/claude-501/<encoded-project-path>/<session-uuid>/tasks — this is:

  • Undocumented — not in the settings schema or docs
  • Unconfigurable — no setting to change the location
  • Opaque — the encoded path format and UUID structure aren't explained
  • Fragile — when permissions break (macOS temp cleanup, ownership changes), every

Bash call fails with EACCES: permission denied, mkdir before the actual command
runs

## Observed behavior

Agent hit EACCES on this path, retried 4 times, then attempted TMPDIR workarounds — all
because the error gives no indication it's a sandbox infrastructure problem vs. a
command problem.

## Suggestion

  1. Document the sandbox tmpdir mechanism
  2. Provide a clear error message when sandbox infrastructure fails (e.g. "Sandbox temp

directory could not be created. Run /sandbox to reconfigure.")

  1. Allow configuring the tmpdir location in settings.json
  2. Consider using the project's own .claude/ directory or a user-configurable path

instead of /private/tmp/

## Environment

  • macOS Darwin 25.3.0
  • Claude Code CLI
  • sandbox.enabled: false works as a mitigation but shouldn't be necessary

## Workaround

Disabled sandbox entirely via "sandbox": { "enabled": false } in settings.json.
Using hooks and deny rules as the enforcement layer instead.

View original on GitHub ↗

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