Interrupted auto-update leaves claude broken (missing bin symlink, placeholder stub, truncated native binary) with no self-healing

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 2 comments · opened Aug 5, 2026

Bug Report: Interrupted auto-update leaves claude broken and unrecoverable without manual intervention

Summary

Killing the Claude Code CLI (Ctrl-C / force quit) during an auto-update leaves the install in a broken state:

  • the claude command disappears from PATH (the npm bin symlink is missing),
  • the leftover ~/.claude/.update.lock holds the PID of the dead process, which can block future updates,
  • the native binary can be left truncated/corrupt (bin/claude.exe was a 500-byte placeholder stub, and a partially-extracted native package crashed with SIGBUS).

There is no self-healing: Claude Code does not detect that the update was interrupted, and the only reliable fix is a manual full reinstall.

Environment

  • OS: Linux (WSL2), x86_64
  • Install method: global npm package @anthropic-ai/claude-code (npm prefix ~/.npm-global)
  • Version transition: 2.1.220 -> 2.1.221 -> 2.1.222 (interrupted during update)
  • Node: v24.18.0

Steps to reproduce

  1. Start claude (auto-update triggers).
  2. Force-quit the process while the update is in progress (before it finishes).
  3. On next shell: claude -> command not found.

What was found (diagnosis)

  • ~/.npm-global/bin/claude symlink was absent (only a stale hidden .claude-XXXXXX symlink pointing at the package stub remained).
  • @anthropic-ai/claude-code/bin/claude.exe was the 500-byte placeholder stub ("Error: claude native binary not installed"), i.e. the postinstall (install.cjs) had not completed.
  • The optional native package @anthropic-ai/claude-code-linux-x64 was partially extracted: the claude binary existed but package.json was missing, so require.resolve in install.cjs failed and the postinstall could not repair itself.
  • Manually copying that partially-downloaded ~42 MB binary into bin/claude.exe produced SIGBUS (Bus error, exit 135) on every run — even ldd crashed on the file. The binary was truncated/corrupt.
  • ~/.claude/.update.lock contained the PID of the force-quit process (dead), potentially blocking the autoupdater.

Fix that worked

npm install -g @anthropic-ai/claude-code@latest

A full reinstall re-downloaded the complete ~289 MB native binary, ran postinstall, and recreated the claude bin symlink. After that claude --version -> 2.1.222.

Suggested improvements

  1. Validate postinstall completion. The autoupdater should verify bin/claude.exe is the real native binary (not the placeholder stub) and that the native package is fully extracted before considering the update successful.
  2. Recover stale .update.lock. A lock whose PID is no longer alive should be treated as stale and cleared automatically.
  3. Self-heal on launch. If the binary is the placeholder stub or crashes with SIGBUS (corrupt/truncated file), Claude Code should detect this and re-run install.cjs (or trigger a repair) instead of silently disappearing from PATH.
  4. Atomic symlink/bin placement. The claude bin symlink and the native binary copy should be committed atomically so an interrupted update cannot leave a partially-linked install.

Impact

Any user who force-quits during an update is left without a working claude command and no in-tool recovery path. Recovery requires shell-level knowledge of npm and manual reinstall.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗