[BUG] gradle being blocked by sandbox even though it's dir off of ~ is in the allow list

Resolved 💬 4 comments Opened Jan 20, 2026 by codeslubber Closed Feb 28, 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?

I have been trying to get gradle to work with the sandbox and it's been insane. Claude told me to come report here because it's clearly in the sandbox files but it's still getting blocked.

What Should Happen?

The whole sandbox has been hell on earth, I can't remember the last time I have spent so much time trying to get something that should be pretty basic to work. And because it doesn't if I walk away from my desk I can be assured I will come back to a stuck screen.

Error Messages/Logs

Error: Exit code 1                                                                           
     Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException:        
     /Users/robwilliams/.gradle/wrapper/dists/gradle-8.13-bin/34ap19oldls385r5fs6rspcrap/gradle-8.
     3-bin.zip.lck (Operation not permitted)                                                      
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78
        at org.gradle.wrapper.Install.createDist(Install.java:47)                                 
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)                   
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)                   
     Caused by: java.io.FileNotFoundException: /Users/robwilliams/.gradle/wrapper/dists/gradle-8.1
     -bin/34ap19oldls385r5fs6rspcrap/gradle-8.13-bin.zip.lck (Operation not permitted)            
        at java.base/java.io.RandomAccessFile.open0(Native Method)                                
        at java.base/java.io.RandomAccessFile.open(RandomAccessFile.java:356)                     
        at java.base/java.io.RandomAccessFile.<init>(RandomAccessFile.java:273)  


You're right, I should look more carefully. The FileNotFoundException with "Operation not       
  permitted" is Java's way of reporting a sandbox/permission block - but let me verify the        
  directory actually exists:                                                                      
                                                                                                  
⏺ Bash(ls -la                                                                                     
      /Users/robwilliams/.gradle/wrapper/dists/gradle-8.13-bin/34ap19oldls385r5fs6rspcrap/)       
  ⎿  total 267552                                                                                 
     drwxr-xr-x@ 6 robwilliams  staff        192 Jul 25 13:18 .                                   
     drwxr-xr-x@ 4 robwilliams  staff        128 Jul 25 13:46 ..                                  
     … +4 lines (ctrl+o to expand)                                                                
                                                                                                  
⏺ The directory and .lck file both exist. So the sandbox is blocking the write operation despite  
  ~/.gradle being in the allowlist. Java just reports it as FileNotFoundException when it can't   
  open a file for writing.                                                                        
                                                                                                  
  Let me test if basic writes to that directory work:                                             
                                                                                                  
⏺ Bash(touch /Users/robwilliams/.gradle/test-sandbox-write && rm                                  
      /Users/robwilliams/.gradle/test-sandbox-write && echo "write succeeded")                    
  ⎿  Error: Exit code 1                                                                           
     touch: /Users/robwilliams/.gradle/test-sandbox-write: Operation not permitted                
                                                                                                  
⏺ Confirmed - the sandbox is blocking writes to ~/.gradle even though it's in your allowlist. This
   is a bug - the sandbox isn't respecting the configured sandbox.write.allow paths.              
                                                                                                  
  Worth reporting to the Claude Code team. Your settings are correct, but the sandbox isn't       
  honoring them.

Steps to Reproduce

put ~/.gradle in the allowed writes list and try and run it

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.12

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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