claude-code - 💡(How to fix) Fix [BUG] Installer places binary in VS Code Snap directory, leading to silent uninstallation on Ubuntu

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Root Cause

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.

Code Example

claude: command not found
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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:

  1. Detection: Check for $SNAP environment variable or paths matching ~/snap/*/.
  2. 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.
  3. 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

  1. Install Ubuntu (24.04 or 26.04) with Snaps enabled.
  2. Install VS Code via the Snap package (sudo snap install code --classic).
  3. Open VS Code and open the integrated terminal.
  4. Run the official Claude Code installer script.
  5. Verify installation works (claude --version). Note that the binary is located at ~/snap/code/<current-revision>/.local/share/....
  6. Trigger a VS Code update (e.g., sudo snap refresh code or wait for auto-update).
  7. Wait for the system to garbage-collect old Snap revisions (or manually remove an old revision if multiple exist).
  8. Run claude --version again. 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Installer places binary in VS Code Snap directory, leading to silent uninstallation on Ubuntu