Skip to content

fix(db): graceful FTS5 fallback when Node.js build lacks FTS5 support (#1532) - #1625

Open
aniruddhaadak80 wants to merge 1 commit into
colbymchenry:mainfrom
aniruddhaadak80:fix/fts5-graceful-fallback
Open

fix(db): graceful FTS5 fallback when Node.js build lacks FTS5 support (#1532)#1625
aniruddhaadak80 wants to merge 1 commit into
colbymchenry:mainfrom
aniruddhaadak80:fix/fts5-graceful-fallback

Conversation

@aniruddhaadak80

Copy link
Copy Markdown

What Problem This Solves

codegraph v1.5.0 uses Node.js built-in node:sqlite and requires FTS5, but official Node.js binaries do not compile FTS5 by default. This causes codegraph init and codegraph index to fail on any standard Node.js installation with Error: no such module: fts5.

Why This Change Was Made

The schema at src/db/schema.sql:117 creates an FTS5 virtual table unconditionally. When FTS5 is not available in the SQLite build bundled with Node.js, the entire schema execution fails, preventing codegraph from functioning at all.

User Impact

codegraph now works on Node.js builds without FTS5. When FTS5 is unavailable:

  • Schema creation succeeds (FTS5 parts are skipped with a console warning)
  • Search falls back to LIKE + fuzzy matching (already implemented in searchNodes)
  • Bulk-load operations skip FTS5 trigger management
  • Full-text search performance is reduced but functional

Evidence

…colbymchenry#1532)

Official Node.js binaries do not compile FTS5 by default, causing codegraph
init to fail with 'no such module: fts5'. Added runtime FTS5 detection:
- Split schema execution to try FTS5 separately, skip on failure with warning
- Added fts5Available flag to DatabaseConnection and QueryBuilder
- Bulk-load and search paths skip FTS5 operations when unavailable
- Search falls back to LIKE + fuzzy matching when FTS5 is missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant