Environment
- basic-memory 0.20.3 (installed via
uv tool install basic-memory)
- Python 3.12.11 (uvx-managed CPython for Windows)
- OS: Windows 11 Pro 26200
- sqlite-vec 0.1.9
- Default config (
semantic_search_enabled: true, fastembed bge-small-en-v1.5)
Symptom
basic-memory reindex -p <project> populates the knowledge graph (entities, relations, observations) but generates 0 embeddings. Status panel reports:
Indexed: 0/258
Status: Reindex recommended
Reason: SQLite vector tables exist but sqlite-vec is unavailable in this Python environment — install/update basic-memory, then run: bm reindex --embeddings
Running the suggested fix bm reindex -p vault --embeddings raises:
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such module: vec0
[SQL: DELETE FROM search_vector_embeddings WHERE rowid IN (SELECT id FROM search_vector_chunks WHERE project_id = ? AND entity_id NOT IN (SELECT id FROM entity WHERE project_id = ?))]
Diagnosis
sqlite-vec loads correctly in the same uvx environment when invoked directly:
$ uvx --from basic-memory python -c "
import sqlite3, sqlite_vec
conn = sqlite3.connect(':memory:')
conn.enable_load_extension(True)
sqlite_vec.load(conn)
print(conn.execute('SELECT vec_version()').fetchone())
"
('v0.1.9',)
So the package is installed and loadable. The bug appears to be that basic-memory's worker SQLAlchemy connections don't call enable_load_extension + sqlite_vec.load() before issuing queries that depend on the vec0 virtual table.
Suggested fix
Hook a connect event on the SQLAlchemy engine to enable extension loading and load sqlite_vec on each new connection, similar to:
from sqlalchemy import event
import sqlite_vec
@event.listens_for(engine, "connect")
def _on_connect(dbapi_conn, _):
dbapi_conn.enable_load_extension(True)
sqlite_vec.load(dbapi_conn)
dbapi_conn.enable_load_extension(False)
Side note (separate issue, can file if useful)
basic-memory project default <name> is currently a no-op — returns "No default project is currently set" even after project add, and editing default_project directly in ~/.basic-memory/config.json gets reverted on the next CLI invocation.
Environment
uv tool install basic-memory)semantic_search_enabled: true, fastembedbge-small-en-v1.5)Symptom
basic-memory reindex -p <project>populates the knowledge graph (entities, relations, observations) but generates 0 embeddings. Status panel reports:Running the suggested fix
bm reindex -p vault --embeddingsraises:Diagnosis
sqlite-vecloads correctly in the same uvx environment when invoked directly:So the package is installed and loadable. The bug appears to be that basic-memory's worker SQLAlchemy connections don't call
enable_load_extension+sqlite_vec.load()before issuing queries that depend on thevec0virtual table.Suggested fix
Hook a
connectevent on the SQLAlchemy engine to enable extension loading and loadsqlite_vecon each new connection, similar to:Side note (separate issue, can file if useful)
basic-memory project default <name>is currently a no-op — returns "No default project is currently set" even afterproject add, and editingdefault_projectdirectly in~/.basic-memory/config.jsongets reverted on the next CLI invocation.