[BUG] Auto-update breaks better-sqlite3 dependency causing sqlite DB access errors.

Resolved 💬 8 comments Opened May 7, 2025 by abraithwaite Closed May 14, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.103 (Claude Code) (Started around 0.2.91)
  • Operating System: macOS Sequoia 15.4.1
  • Terminal: ghostty 1.0.1

Using Claude installed with npm globally and nodejs installed via homebrew.

$ node --version
v23.11.0
$ which node
/opt/homebrew/bin/node
$ ls -lah $(which claude)
lrwxr-xr-x@ 1 abraithwaite  admin    52B May  6 19:36 /opt/homebrew/bin/claude -> ../lib/node_modules/@anthropic-ai/claude-code/cli.js

Bug Description

Whenever claude auto-update runs, I need to manually rebuild the better-sqlite3 dependency. Something is clearing it's build artifacts.

Steps to Reproduce

  1. Install Claude via npm globally, npm/nodejs installed via Homebrew.
  2. Wait for Claude to auto-update
  3. Restart claude after auto-update and the database will fail to open because the bindings were deleted.

Expected Behavior

I expect either the gyp bindings to not be deleted or for them to be rebuilt automatically.

Actual Behavior

The gyp bindings for better-sqlite3 are deleted and not rebuilt, causing claude to fail to open the sqlite database.

Workaround

cd /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/node_modules/better-sqlite3
npm run build-release

Additional Context

Build log for better-sqlite3: https://gist.github.com/abraithwaite/2547c53f3230f2ef28bc11b1835a4b09

Notably: I ran these commands right after claude auto-updated ☝. Note the files missing from the better-sqlite dependency tree.

The error text (notice "Database unavailable"). This state persists after restart until I rebuild the better-sqlite3 dependency.

╭─────────────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview!                          │
│                                                                     │
│   /help for help, /status for your current setup                    │
│                                                                     │
│   cwd: /Users/abraithwaite/Projects/github.com/runreveal/runreveal  │
│                                                                     │
│   Account: API                                                      │
╰─────────────────────────────────────────────────────────────────────╯

 ✔ Loaded project memory • /memory
 ⚠ Database unavailable: continue/resume features disabled • /doctor

╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ > Try "fix lint errors"                                                                                                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  Press Ctrl-D again to exit

View original on GitHub ↗

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