Error is in the agent shell sandbox bundled with Cursor IDE (cursorsandbox) . Attempting to blackhole a .env file in a different (inaccessible) project folder: reports ‘Failed to bind blackhole to “/project_path/.env”: IO error: No such file or directory (os error 2)"’ It then fails out meaning that the sandbox is not established.
Steps to Reproduce
Happens every time an agent is trying to do anything involving setup of a sandbox in a different project from my main project folder
Expected Behavior
If the target file needing blackhole protection is not accessible, the protection is not required. Process should continue and allow sandbox setup to continue.
Operating System
Linux
Version Information
Version: 3.29.9
Commit: 306d153d51d714882ab7b1bc49649cab624e8a30
Platform: Linux x64
OS: Linux 7.0.0-42-generic
Channel: stable
VS Code base: 1.128.0
Where does that other project actually live? If you can share the output of findmnt -T /path/to/other/project (feel free to mask your username), I’m especially interested in whether it’s on a drive mounted under /run/media/... or a similar location.
Thanks @nickov8, that rules out the external drive idea, since the project is on your main disk.
My next suspect is the .env file itself. If it’s a symlink pointing to a file that doesn’t exist (or somewhere that isn’t reachable from that project), the sandbox trips on exactly this error. Could you run these in that other project folder and paste the output?
ls => -rw-rw---- 1 nick nick 109 Aug 28 15:41 .env
readlink: /home/nick/DockerProjects/SPACE_AI/.env
There’s nothing strange about the file; I think it is simply that it is a prohibited file (Cursor is already blocking it from access from within Cursor, because it contains sensitive secrets)
So the part of sandbox set up that is trying to blackhole it isn’t finding it
Which is fine, except that that causes error
Thanks @nickov8, that rules out the symlink idea. It’s an ordinary file, so the sandbox shouldn’t be failing on it, and I agree it should skip a file it can’t find instead of stopping.
In the meantime you can get past it in Cursor Settings → Agents → Execution and Approvals by setting the run mode to Ask Every Time. Commands then wait for your approval and run without the sandbox. Run Everything (Unsandboxed) also works, but only use it on projects you trust.
I can’t tell from here why the sandbox loses sight of the file, and I’d rather not keep guessing. A debug trace would show it:
Quit Cursor completely.
Start it from a terminal with SBX_DEBUG=1 cursor (or however you normally launch it, with SBX_DEBUG=1 in front).
Reproduce the error the way it normally happens, with the agent running a command in that other project.
Copy the lines starting with sandbox: from the command output, from step 4/7 down to the error, and paste them here.
Please leave the paths as they are if you can. If you’d rather mask a name, replace it the same way everywhere.