[BUG] Auto-update leaves installation in broken state with incomplete package files
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?
After accepting the auto-update prompt (from ~2.1.1 to 2.1.2), Claude Code stopped working. Running claude or claude update produces:
/Users/jetbrains/.claude/local/claude: line 2: /Users/jetbrains/.claude/local/node_modules/.bin/claude: No such file or directory
/Users/jetbrains/.claude/local/claude: line 2: exec: /Users/jetbrains/.claude/local/node_modules/.bin/claude: cannot execute: No such file or directory
Investigation revealed:
- The symlink in
~/.claude/local/node_modules/.bin/was named.claude-4RefIwJ(temporary name) instead ofclaude - The
@anthropic-ai/claude-code/directory contained only avendorfolder - missingcli.jsand all other package files
The auto-updater appears to have been interrupted mid-process, leaving both the symlink rename and package extraction incomplete.
What Should Happen?
Auto-update should either complete fully or rollback to the previous working state. The installation should never be left in a broken state where the CLI is unusable.
Error Messages/Logs
/Users/jetbrains/.claude/local/claude: line 2: /Users/jetbrains/.claude/local/node_modules/.bin/claude: No such file or directory
/Users/jetbrains/.claude/local/claude: line 2: exec: /Users/jetbrains/.claude/local/node_modules/.bin/claude: cannot execute: No such file or directory
Steps to Reproduce
- Have Claude Code installed via the local installation method (
~/.claude/local/) - Accept the auto-update prompt when a new version is available
- (Uncertain what triggers the failure - possibly network interruption or timing issue during update)
- After update completes, run
claude- command fails
To verify the broken state:
ls -la ~/.claude/local/node_modules/.bin/shows temporary symlink name like.claude-4RefIwJinstead ofclaudels -la ~/.claude/local/node_modules/@anthropic-ai/claude-code/shows onlyvendordirectory, missingcli.js
Workaround: cd ~/.claude/local && rm -rf node_modules package-lock.json && npm install
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.1 (approximately)
Claude Code Version
2.1.2 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
The issue suggests the auto-updater lacks atomic update guarantees. Potential improvements:
- Use atomic rename for symlinks
- Verify package integrity before removing old version
- Implement rollback on failure
Screenshots attached showing the broken symlink name and incomplete package directory.
<img width="80%" alt="Image" src="https://github.com/user-attachments/assets/58b590d7-8ab9-4097-ae38-4dcfd47b2971" />
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗