fix: gracefully degrade when sqlite-vec cannot load#61
Merged
Conversation
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
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the crash:
This build of sqlite3 does not support dynamic extension loadingWhen installed via
bun install -g @enbox/memorydon macOS (Bun 1.2.x), the SQLite build bundled with Bun may lack dynamic extension loading support. Thesqlite-vecextension requiresloadExtension(), causing the entire CLI to crash on any command that touches the sidecar (init, serve, search, compact).Changes
SidecarDatabase:tryLoadVec()wrapssqliteVec.load()in try/catch; exposeshasVectorSearchbooleanSearchIndex: AcceptshasVectorSearchflag; skips vector KNN queries when false, falls back to FTS5-only search with keyword matchingCompactionEngine: AcceptshasVectorSearchflag; skips vector-based duplicate merging when falsebootstrapSidecar(): Prints a warning when sqlite-vec fails to load, explaining the degradationIncludes changeset for patch release (v0.1.1)
Verification
bun run build— zero errorsbun test .spec.ts— 256 tests pass (21 files)bun run lint— zero warnings