[BUG] Installer places binary in VS Code Snap directory, leading to silent uninstallation on Ubuntu
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?
When the Claude Code installer is run from within VS Code's integrated terminal on Ubuntu (where VS Code is installed as a Snap package), the installer respects the XDG_DATA_HOME or $HOME environment variables provided by the Snap sandbox.
This causes the binary to be installed into an ephemeral, revision-scoped directory:~/snap/code/<revision>/.local/share/claude/versions/<version>
Because Snap packages are immutable and old revisions are garbage-collected during updates, this directory is temporary. When VS Code updates and the system cleans up previous revisions (e.g., Revision 243), the directory containing the Claude binary is deleted. The symlink in ~/.local/bin/claude remains but points to a non-existent path, effectively "uninstalling" the tool without user intervention.
What Should Happen?
The installer should detect if it is running inside a Snap sandbox (specifically VS Code) and handle the installation path more robustly:
- Detection: Check for
$SNAPenvironment variable or paths matching~/snap/*/. - Fallback: If detected, override the target directory to install into the user's actual install directory (or some sensible default) (
~/.local/share/claude) rather than the Snap's ephemeral data folder. - Alternatively, print a clear warning message and ask the user to install outside of a snap sandboxed app.
Error Messages/Logs
claude: command not found
Steps to Reproduce
- Install Ubuntu (24.04 or 26.04) with Snaps enabled.
- Install VS Code via the Snap package (
sudo snap install code --classic). - Open VS Code and open the integrated terminal.
- Run the official Claude Code installer script.
- Verify installation works (claude --version). Note that the binary is located at
~/snap/code/<current-revision>/.local/share/.... - Trigger a VS Code update (e.g.,
sudo snap refresh codeor wait for auto-update). - Wait for the system to garbage-collect old Snap revisions (or manually remove an old revision if multiple exist).
- Run
claude --versionagain. The command will fail with "No such file or directory" because the target path has been deleted by the Snap package manager.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.159
Platform
Other
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Users who primarily use VS Code's integrated terminal will experience a silent failure of their CLI tool after routine IDE updates.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗