Skip to content

[Bug]: better-sqlite3 NODE_MODULE_VERSION mismatch with concurrent sessions using different Node versions (mise/asdf) #148

@husniadil

Description

@husniadil

Platform

Claude Code

context-mode version

1.0.25

Doctor output

Server test: PASS
PreToolUse hook: PASS
SessionStart hook: PASS
Hook script exists: PASS
Plugin enabled: PASS
FTS5 / better-sqlite3: PASS (from Node 24 session)
FTS5 / better-sqlite3: FAIL (from Node 20 session — same machine, concurrent)

Prompt that triggered the bug

Starting Claude Code from two different projects — one with Node 24 (via mise .tool-versions), another with Node 20 (global default). The session started second gets NODE_MODULE_VERSION mismatch.

What happened?

When using mise with different Node versions per project, concurrent Claude Code sessions cause NODE_MODULE_VERSION mismatch on better-sqlite3. The plugin cache has a single native binary, but each session resolves a different Node ABI version.

  • Node 24.11.0 = ABI 137
  • Node 20.19.4 = ABI 115

Whichever session starts first (or last rebuild) "wins". The other session gets:

The module '.../better_sqlite3.node' was compiled against a different
Node.js version using NODE_MODULE_VERSION 137. This version of Node.js
requires NODE_MODULE_VERSION 115.

v1.0.25's auto-rebuild on upgrade helps for single-session usage but doesn't solve concurrent cross-version sessions.

Expected behavior

context-mode should work across concurrent sessions regardless of which Node version each session uses.

Steps to reproduce

  1. Install mise with Node 20.x and Node 24.x
  2. Project A: .tool-versions with node 24.x
  3. Project B: uses global Node 20.x (or its own .tool-versions)
  4. Launch Claude Code in Project A → context-mode works
  5. Launch Claude Code in Project B concurrently → FTS5/better-sqlite3 FAIL

Setup details

  • MCP server registered
  • Hooks configured (PreToolUse, PostToolUse, SessionStart, etc.)
  • Routing instruction file present (CLAUDE.md / GEMINI.md / AGENTS.md / copilot-instructions.md)

Debug logs

Error: The module '/Users/xxx/.claude/plugins/cache/context-mode/context-mode/1.0.20/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 137. This version of Node.js requires
NODE_MODULE_VERSION 115. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

Operating System

macOS

JS Runtime

Node 20.19.4 + Node 24.11.0 (via mise, concurrent sessions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions