Where does the bug appear (feature/product)?
Somewhere else…
Describe the Bug
Where does the bug appear (feature/product)?
Cursor IDE devcontainers / remote container workflow, specifically Cursor sandbox caches created inside Docker/OrbStack devcontainers.
This appears to involve Cursor-created directories at:
/tmp/cursor-sandbox-cache
inside devcontainers. These caches were persisted in each container’s writable layer and were not automatically bounded or cleaned up.
Describe the Bug
Cursor devcontainers accumulated extremely large build sandbox caches under /tmp/cursor-sandbox-cache inside the container filesystem. Because the directory lives inside the Docker container writable layer, the data persisted across devcontainer restarts and caused the OrbStack backing disk image to grow dramatically.
In this case, the issue consumed over 1 TB of disk space:
- One devcontainer for
zpl-toolchaingrew to approximately1.08TB. - Another devcontainer for
wunderbarcodegrew to approximately160GB. - The host machine’s disk, a 2 TB Mac volume, was nearly full before cleanup.
- The largest source was not the project workspace itself; it was Cursor sandbox cache data inside container
/tmp.
The root cause we identified was repeated sandbox cache directories containing Rust/Cargo build artifacts:
/tmp/cursor-sandbox-cache/<hash>/cargo-target/...
Examples of large files found inside those cache directories included:
/tmp/cursor-sandbox-cache/<hash>/cargo-target/debug/libzpl_toolchain_ffi.a
/tmp/cursor-sandbox-cache/<hash>/cargo-target/debug/deps/libzpl_toolchain_ffi.a
Several individual cache directories were multiple GB each. In the zpl-toolchain container, there were 264 top-level sandbox cache directories, most containing cargo-target subdirectories. The cache had grown to nearly 1 TB.
This is particularly dangerous because the space usage is hidden from normal project cleanup. Cleaning the repository, deleting local target/, removing temporary project artifacts, and shrinking the bind-mounted workspace did not meaningfully shrink the devcontainer because the data was in the container writable layer, not in the project directory.
Steps to Reproduce
I do not yet have a minimal deterministic reproduction, but this is the observed workflow that produced the issue:
- Use Cursor IDE on macOS.
- Use devcontainers backed by OrbStack/Docker.
- Work in Rust-heavy projects where Cursor agents / sandboxed tasks / build-related workflows repeatedly run builds or checks.
- Use devcontainers over time across repeated sessions.
- Observe Docker container writable layer growth even when the bind-mounted project directory is much smaller.
Diagnostic commands used:
docker ps -a --size --format 'table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Image}}\t{{.Size}}'
Before cleanup, relevant containers showed:
stoic_hofstadter vsc-zpl-toolchain-... 1.08TB (virtual 1.09TB)
trusting_pike vsc-wunderbarcode-... 160GB (virtual 165GB)
Inspecting inside the zpl-toolchain container:
docker exec stoic_hofstadter sh -lc 'df -h; du -xhd 1 / 2>/dev/null | sort -hr | head -80'
Key result:
1017G /
1009G /tmp
4.5G /usr
3.7G /root
Drilling into /tmp:
docker exec stoic_hofstadter sh -lc 'du -xhd 2 /tmp 2>/dev/null | sort -hr | head -100'
Key result:
1009G /tmp
999G /tmp/cursor-sandbox-cache
Counting and aging the cache directories:
docker exec stoic_hofstadter sh -lc '
find /tmp/cursor-sandbox-cache -mindepth 1 -maxdepth 1 -type d | wc -l
find /tmp/cursor-sandbox-cache -mindepth 1 -maxdepth 1 -type d -mtime +7 -print0 | xargs -0 du -sch | tail -1
find /tmp/cursor-sandbox-cache -mindepth 1 -maxdepth 1 -type d -mtime -8 -print0 | xargs -0 du -sch | tail -1
'
Key result:
264 total top-level cache dirs
978G older than 7 days
21G newer than 7 days
The old cache directories spanned from February 15, 2026 through May 23, 2026, while the newest were from June 3 and June 9, 2026.
Inspecting the type of cached data:
docker exec stoic_hofstadter sh -lc '
find /tmp/cursor-sandbox-cache -mindepth 2 -maxdepth 2 -printf "%f\n" |
sort | uniq -c | sort -nr | head -40
'
Key result:
218 cargo-target
87 npm
23 go-build
8 nuget
5 pip
5 node-gyp
1 go-mod
Inspecting large files:
docker exec stoic_hofstadter sh -lc '
find /tmp/cursor-sandbox-cache -type f -size +500M -printf "%s\t%TY-%Tm-%Td %TH:%TM\t%p\n" |
sort -nr | head -80
'
Example output:
696026128 2026-02-28 00:00 /tmp/cursor-sandbox-cache/.../cargo-target/debug/libzpl_toolchain_ffi.a
696026128 2026-02-28 00:00 /tmp/cursor-sandbox-cache/.../cargo-target/debug/deps/libzpl_toolchain_ffi.a
664716454 2026-02-26 19:36 /tmp/cursor-sandbox-cache/.../cargo-target/debug/libzpl_toolchain_ffi.a
The second devcontainer showed the same pattern:
docker exec trusting_pike sh -lc 'du -xhd 2 /tmp 2>/dev/null | sort -hr | head -100'
Key result:
147G /tmp
147G /tmp/cursor-sandbox-cache
The wunderbarcode container had 11 top-level cache dirs, all recent, all containing cargo-target directories.
Expected Behavior
Cursor should not allow internal sandbox caches in devcontainers to grow without bounds and persist indefinitely in the Docker writable layer.
Expected behavior would be one or more of:
- Automatically clean stale
/tmp/cursor-sandbox-cacheentries after a reasonable TTL. - Cap the total size of Cursor sandbox caches per devcontainer.
- Store large sandbox caches in a location that is explicitly managed and visible to users.
- Use ephemeral storage for sandbox caches that should not survive devcontainer restarts.
- Warn users when Cursor-managed devcontainer cache usage exceeds a threshold.
- Provide a command in Cursor such as “Clean Devcontainer Sandbox Caches”.
- Avoid duplicating full Rust/Cargo build outputs across many sandbox directories when possible.
The key expectation is that a Cursor-managed cache should not silently consume hundreds of GB or over 1 TB of persistent disk space.
Screenshots / Screen Recordings
No screenshots attached, but the following command outputs document the issue:
Before cleanup:
stoic_hofstadter 1.08TB (virtual 1.09TB)
trusting_pike 160GB (virtual 165GB)
Inside stoic_hofstadter:
1009G /tmp
999G /tmp/cursor-sandbox-cache
Inside trusting_pike:
147G /tmp/cursor-sandbox-cache
After cleanup:
stoic_hofstadter 15.1GB (virtual 19.3GB)
trusting_pike 3.93GB (virtual 8.39GB)
Host disk free space improved substantially after cleanup:
Before targeted cache cleanup: about 210GiB free
After stale zpl-toolchain cache cleanup: about 831GiB free
After full known sandbox cache cleanup: approximately 1.2TiB free
Operating System
MacOS
Version Information
Version: 3.7.21 (Universal)
VS Code Extension API: 1.105.1
Commit: 517f696d8ab6c53eb04fbfdaae705cd146bf3460
Date: 2026-06-07T21:46:09.237Z
Layout: editor
Build Type: Stable
Release Track: Nightly
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
xterm.js: 6.1.0-beta.256
OS: Darwin arm64 25.5.0
For AI issues: which model did you use?
Unknown / multiple Cursor agent sessions over time.
This may involve Cursor’s agent/sandbox behavior rather than one specific model response. The observed directories were named /tmp/cursor-sandbox-cache, and the contents were repeated language build caches, especially Rust/Cargo cargo-target directories.
Additional Information
The cleanup approach that worked was intentionally conservative:
- First, confirmed that the project workspaces themselves were bind-mounted from host paths:
/Users/trevorcampbell/code/zpl-toolchain -> /workspaces/zpl-toolchain
/Users/trevorcampbell/code/wunderbarcode -> /workspaces/wunderbarcode
-
Confirmed the huge data was in the container writable layer, not in the project folders.
-
Closed the devcontainers / Cursor remote sessions.
-
Deleted only Cursor sandbox cache directories inside the affected devcontainers.
Initial conservative cleanup for zpl-toolchain:
docker start stoic_hofstadter
docker exec stoic_hofstadter sh -lc \
'find /tmp/cursor-sandbox-cache -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -rf -- {} +'
docker stop stoic_hofstadter
This reduced stoic_hofstadter from 1.08TB to 37.6GB, leaving 3 recent cache dirs totaling 21G.
After verifying the devcontainer still worked normally, we cleared the remaining known sandbox caches:
docker start trusting_pike stoic_hofstadter
docker exec trusting_pike sh -lc 'rm -rf -- /tmp/cursor-sandbox-cache'
docker exec stoic_hofstadter sh -lc 'rm -rf -- /tmp/cursor-sandbox-cache'
docker stop trusting_pike stoic_hofstadter
Final container sizes:
trusting_pike 3.93GB (virtual 8.39GB)
stoic_hofstadter 15.1GB (virtual 19.3GB)
No project folders, Docker images, or Docker volumes were deleted. The cleanup only removed Cursor’s sandbox cache directory inside the devcontainers.
After cleanup, the devcontainers reopened and appeared to work normally. The main side effect appears to be that Cursor/Rust/Cargo build sandboxes need to rebuild caches.
Why this is problematic
This failure mode is hard for users to discover:
- The project directory may look reasonably sized.
- Normal repository cleanup does not affect the Docker writable layer.
- macOS “System Data” / OrbStack storage can appear huge without explaining that Cursor sandbox caches are the cause.
- Users may be tempted to delete/rebuild whole devcontainers, which is riskier than clearing stale Cursor-managed caches.
Suggested product fixes
- Add automatic TTL cleanup for
/tmp/cursor-sandbox-cache. - Add a configurable max size for sandbox caches per container/workspace.
- Prefer ephemeral cache storage for sandbox data that does not need to survive container restarts.
- Surface cache usage in Cursor’s devcontainer UI.
- Add a command palette action to clean Cursor devcontainer sandbox caches.
- Avoid creating many independent full
cargo-targettrees for repeated agent/sandbox runs when a shared/reused target cache is possible. - Emit a warning when Cursor-managed cache directories exceed thresholds such as 10GB, 50GB, or 100GB.
Cursor itself continued working, but the issue nearly filled a 2 TB disk and made the machine difficult to use until the cache bloat was diagnosed and manually cleaned. Without manual intervention, this could plausibly make Cursor/devcontainers unusable or destabilize the host due to disk exhaustion.
Does this stop you from using Cursor
No - Cursor works, but with this issue