What’s the Issue?
Users of the Snap version of Visual Studio Code have reported that files deleted from within the editor never truly disappear. Instead, they are silently moved to a hidden Trash directory inside the Snap’s sandbox (~/snap/code/current/.local/share/Trash) and remain there indefinitely.
How the Bug Manifests
The symptom is simple but alarming: storage consumption skyrockets without any obvious cause. Reports include:
- 44 GB of “deleted” files after a year of use (as highlighted by Chris Hayes on Mastodon).
- Some users seeing >200 GB of orphaned data after months.
- Inability to empty the internal Trash via the VS Code UI.
Root Causes
Two related bugs are at play:
- Bug #233649 – “deleted files don’t go to trash” – the Snap creates its own trash location instead of the system’s XDG trash.
- Bug #237147 – “Overriding XDG_DATA_HOME in snap leads to multiple problems” – a regression introduced in early 2025 that prevents the internal trash from being cleared during updates.
Both issues cause a “bogus” Trash that persists across Snap revisions, gradually inflating the storage footprint.
Impact on Users
Beyond wasted disk space, the hidden accumulation can:
- Slow down the Snap’s performance as the internal Trash grows.
- Mislead users into thinking their deletions were successful.
- Complicate backup strategies when large, unnecessary files are inadvertently included.
How to Check and Clean Up
1. Open a terminal.
2. Navigate to the hidden Trash folder:cd ~/snap/code/current/.local/share/Trash
3. List its size:du -sh .
4. If the size is significant, delete its contents safely:rm -rf *
**Caution:** Ensure you are inside the correct directory before running the removal command.
Workarounds and Fixes
• Switch to the DEB or .tar.gz distribution of VS Code, which respects the system trash.
• Upgrade to VS Code v1.97.2 or later – the first bug was addressed, but users should verify the second regression is also resolved.
• Manually set XDG_DATA_HOME to a non‑Snap location before launching VS Code:export XDG_DATA_HOME=$HOME/.local/share
Prevent Future Bloat
Regularly audit the Snap’s Trash folder, especially after major updates. Consider automating a monthly cleanup script or using a monitoring tool that alerts when the folder exceeds a threshold (e.g., 5 GB).