Sandbox blocks `uv run` due to .gitignore marker file in uv cache

I’m running into an issue when Cursor Agent tries to run a terminal command with uv run with “Auto-Run in Sandbox” enabled. It always triggers this error:

error: failed to open file /Users/.../.cache/uv/sdists-v9/.gitignore: Operation not permitted (os error 1)

The agent then requests to run the command outside the sandbox, requiring my approval. This prevents me from letting it run autonomously without supervision.

Root cause: The uv package manager creates a .gitignore marker file in its cache directory (~/.cache/uv/) to prevent git from tracking cached files. The sandbox blocks all access to .git* files, so uv run fails even for simple commands like uv run python --version.

What I’ve tried:

  • Deleting the .gitignore file from the cache — uv recreates it on every run
  • Using --no-cache — uv still creates this file in its temp directory
  • Using UV_CACHE_DIR to put the cache inside the workspace — still blocked

The only workaround I’ve found is requesting all permissions, which defeats the purpose of the sandbox.

Potential fixes (suggested by Claude, not sure if they’d work):

  • Allow git_write permission to cover .gitignore files (currently it doesn’t seem to)
  • Distinguish between actual git repositories and .git* files in non-git directories

Has anyone else run into this? Is there a recommended workaround, or is this something that could be addressed in the sandbox itself?

Versions

Version: 2.2.43
VSCode Version: 1.105.1
Commit: 32cfbe848b35d9eb320980195985450f244b3030
Date: 2025-12-19T06:06:44.644Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0 (MacOS 26.1)
uv: 0.9.18

Transcript of Cursor chat I used to debug: Cursor uv run sandbox error · GitHub

Hey, thanks for the report. This is a known sandbox limitation. It blocks all .git* files for security.

Try adding an exception in the Global Cursor Ignore List:

  1. Open Settings CMD+,
  2. Search for “Global Cursor Ignore List”
  3. Add a pattern to exclude .gitignore files in the uv cache

However, since the files are in ~/.cache (outside the workspace), this might not work. I’ll pass this to the dev team. The sandbox should treat .gitignore marker files in caches differently from real git repos.

As a temporary workaround, allow the needed commands in the Command Allowlist instead of using all permissions. That’s safer than full access.

Could you share whether the Global Cursor Ignore List workaround helped?

Adding **/.gitignore and **/.git to Global Cursor Ignore List didn’t seem to change anything. Even when using UV_CACHE_DIR=.uv-cache uv run ... to put the cache dir in the workspace didn’t matter.

Allowlisting uv run would mean these commands are allowed to run outside of the sandbox, right? Since uv run can be used to execute arbitrary code, that would be potentially unsafe.

At the moment I don’t have a workaround other than manually reviewing and accepting each uv command to run outside the sandbox.

Thanks for the detailed feedback on the workaround. I can confirm this is a legitimate issue. The sandbox should distinguish marker .gitignore files in package manager caches from real Git repositories.

Right now, the only option is to manually approve each uv run command. Adding this to an allowlist is indeed unsafe for arbitrary code.

I’ll pass this to the dev team as a bug so we can improve the sandbox detection logic. Thanks for the Gist, it’ll really help us reproduce the issue.

1 Like

Thank you! Is there a public place where I can track this issue?

Unfortunately we don’t have a public issue tracker, but you can follow updates in this forum thread. Once a fix is ready, we’ll update the topic.

Thanks for the detailed report and the Gist, it really helps the team reproduce the issue.

1 Like

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.