Skip to content

fix: gracefully degrade when sqlite-vec cannot load#61

Merged
LiranCohen merged 1 commit into
mainfrom
fix/sqlite-vec-graceful
Feb 25, 2026
Merged

fix: gracefully degrade when sqlite-vec cannot load#61
LiranCohen merged 1 commit into
mainfrom
fix/sqlite-vec-graceful

Conversation

@LiranCohen

Copy link
Copy Markdown
Contributor

Summary

Fixes the crash: This build of sqlite3 does not support dynamic extension loading

When installed via bun install -g @enbox/memoryd on macOS (Bun 1.2.x), the SQLite build bundled with Bun may lack dynamic extension loading support. The sqlite-vec extension requires loadExtension(), causing the entire CLI to crash on any command that touches the sidecar (init, serve, search, compact).

Changes

  • SidecarDatabase: tryLoadVec() wraps sqliteVec.load() in try/catch; exposes hasVectorSearch boolean
  • SearchIndex: Accepts hasVectorSearch flag; skips vector KNN queries when false, falls back to FTS5-only search with keyword matching
  • CompactionEngine: Accepts hasVectorSearch flag; skips vector-based duplicate merging when false
  • bootstrapSidecar(): Prints a warning when sqlite-vec fails to load, explaining the degradation
  • All other functionality works normally: FTS5 search, task graph, audit, DWN protocols, identity management

Includes changeset for patch release (v0.1.1)

Verification

  • bun run build — zero errors
  • bun test .spec.ts — 256 tests pass (21 files)
  • bun run lint — zero warnings

sqlite-vec requires dynamic extension loading in SQLite, which is not
available in all Bun builds (notably some macOS versions). Previously
this crashed the entire CLI with 'does not support dynamic extension loading'.

Now:
- SidecarDatabase.tryLoadVec() catches the error and sets hasVectorSearch=false
- SearchIndex skips vector KNN queries, falling back to FTS5-only search
- CompactionEngine skips vector-based duplicate merging
- bootstrapSidecar() prints a warning when vector search is disabled
- All other functionality (FTS5 search, task graph, audit, etc.) works normally
@LiranCohen LiranCohen merged commit 77b520c into main Feb 25, 2026
3 checks passed
@github-actions github-actions Bot mentioned this pull request Feb 25, 2026
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