Sandbox Permission denied

Resolved 💬 2 comments Opened Dec 23, 2025 by Flaxoos Closed Dec 23, 2025

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?

Agent tries running go build, which needs to create a tmpdir, gets permission denied. (working in yolo mode, so i granted all permissions)

⏺ Bash(task _check) timeout: 3m 0s
  ⎿  Error: Exit code 201
     task: [format] gofmt -w .
     task: [format] go run github.com/daixiang0/gci@v0.13.7 write . --skip-generated -s standard -s default
     go: creating work dir: mkdir /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/go-build2337539837: permission denied
     task: Failed to run task "_check": exit status 1

⏺ Bash(go build ./...)
  ⎿  Error: Exit code 1
     go: creating work dir: mkdir /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/go-build2993427605: permission denied

⏺ Bash(TMPDIR=/tmp go build ./...)
  ⎿  Error: Exit code 1
     # git.xxx.co/modules/wire-batch-sdk/internal/subscriber
     internal/subscriber/subscriber.go:165:53: in call to telemetry.ProcessMessageWithTrace, type batch.ResponseHandler of sub.handler does not match func(context.Context, *T) error (cannot
      infer T)

Agent explaining:

Good question. There are two separate temp directory issues happening:

  1. claude-XXXX-cwd errors (the shell wrapper)
  zsh:1: permission denied: /var/folders/.../claude-a9f9-cwd
  This is Claude Code's bash sandbox trying to track the current working directory between commands. It writes a small file to remember where it is. This is failing but commands still execute.

  2. go-buildXXXXXXX errors (Go compiler)
  go: creating work dir: mkdir /var/folders/.../go-build2703794680: permission denied
  This is Go's compiler. Go always needs a temp directory to store intermediate build artifacts (.o files, cached compilations, etc.). There's no way to run go build or go run without it.

  The root cause:
  /var/folders/zz/.../T/ is macOS's standard temp directory location. The Claude Code sandbox I'm running in apparently doesn't have write access to it. This is likely a security restriction in how Claude Code executes bash commands.

  Why you haven't seen this before:
  I don't know - it could be:
  - A recent change to the sandbox permissions
  - Something specific to this session
  - A transient environment issue
> /doctor 

 Diagnostics
 └ Currently running: native (2.0.76)
 └ Path: /Users/ido/.local/bin/claude
 └ Invoked: /Users/ido/.local/share/claude/versions/2.0.76
 └ Config install method: native
 └ Auto-updates: enabled
 └ Search: OK (bundled)

What Should Happen?

I've never seen this happen before, it normally workls fine, no permission denied

Error Messages/Logs

Steps to Reproduce

run claude in yolo mode in a go project
tell it to run go build ./..

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Probably the previous one

Claude Code Version

2.0.76

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

also using zsh 5.9 (arm64-apple-darwin24.0)

View original on GitHub ↗

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