pi-memory icon indicating copy to clipboard operation
pi-memory copied to clipboard

node:sqlite missing FTS5 support causes runtime failure in MemoryStore

Open Otherworldy opened this issue 7 months ago • 1 comments

Description

When using pi-memory in a standard Node.js environment, the library fails during initialization with the following error:

Warning: pi-memory: failed to open store: no such module: fts5

Environment

  • OS: Windows 11
  • Node.js: v22.14.0
  • pi-memory: latest
  • SQLite (node:sqlite): built-in (no FTS5)

Steps to Reproduce

  1. Install and use pi-memory
  2. Observe error during migration:
no such module: fts5

Otherworldy avatar Apr 20 '26 01:04 Otherworldy

Fixed in 9861f2a.

The root cause is that node:sqlite on Node 22/23 is compiled without SQLITE_ENABLE_FTS5 — this is a known upstream issue (nodejs/node#56476) affecting all platforms.

The fix wraps FTS5 table creation in a try/catch and gracefully falls back to the existing substring-matching search when FTS5 isn't available. For typical memory store sizes (hundreds of entries), the fallback performs identically. FTS5 will still be used automatically on Node builds that include it.

No new dependencies required.

samfoy avatar Apr 21 '26 06:04 samfoy