Native installer leaves 0-byte stub on interrupted update, breaks launcher
Claude Code native installer writes versioned binaries to ~/.local/share/claude/versions/<version>. If the update gets interrupted (network drop, kill, disk full), a 0-byte file with no exec bit gets left at the new version path.
I hit this on macOS when 2.1.167 was being installed. The file was 0 bytes:
$ ls -la ~/.local/share/claude/versions/
-rwxr-xr-x 1 joe staff 220M 2.1.166
-rw-r--r-- 1 joe staff 0B 2.1.167
My wrapper (picks latest version and execs it) then fails:
claude: .../versions/2.1.167: Permission denied
claude: exec: .../versions/2.1.167: cannot execute: Undefined error: 0
The npm wrapper does not have this problem — placeBinary() in install.cjs does an atomic hardlink/copy then chmodSync after the write succeeds. The native installer's version-write flow appears to write directly to the version path, so an interruption leaves the stub visible to any launcher.
MRE with CI that reproduces the broken pattern and the fix side-by-side: https://github.com/Mearman/claude-atomic-install-mre
CI run: https://github.com/Mearman/claude-atomic-install-mre/actions
Related: #65478 is the Windows side of the same root cause (non-atomic update kills concurrent sessions).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗