You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] SQLite-only startup imports asyncpg unconditionally; MCP server dies when Windows Smart App Control blocks its native extension #2103
On a SQLite-only install, basic-memory mcp imports asyncpg at startup, so the server dies whenever the asyncpg native extension can't be loaded. On Windows 11 with Smart App Control enabled this happens: SAC blocks the unsigned asyncpg\pgproto\pgproto.cp314-win_amd64.pyd, and the MCP server exits before answering initialize (MCP clients only see "Connection closed").
search_refresh_race.py itself says the race "never" happens on SQLite, so SQLite users pay for a Postgres driver import they can't use.
Steps To Reproduce
Windows 11 with Smart App Control On, basic-memory 1.0.0 installed with uv tool install, SQLite backend (default).
Run basic-memory mcp (or connect from Claude Code).
SAC blocks pgproto.cp314-win_amd64.pyd (CodeIntegrity event 3077, Windows Security toast "Part of this app has been blocked").
Expected Behavior
The SQLite path starts without importing asyncpg, as it would without the race helper.
Actual Behavior
ImportError: DLL load failed while importing pgproto: An Application Control policy has blocked this file.
The process exits with code 1. On the same machine SAC also blocked sqlalchemy\util\_collections_cy.cp314-win_amd64.pyd, but SQLAlchemy 2.1 ships pure-Python fallbacks for those, so asyncpg is the only hard blocker on the SQLite path.
Environment
OS: Windows 11 25H2 (build 26200), Smart App Control On
Python version: 3.14.6 (PSF-signed)
Basic Memory version: 1.0.0
Installation method: uv tool install
Client: Claude Code (stdio MCP)
Possible Solution
Import asyncpg lazily in lost_search_refresh_race, or guard it:
try:
fromasyncpg.exceptionsimportDeadlockDetectedError, UniqueViolationErrorexceptImportError: # SQLite-only installs, or a blocked native extensionDeadlockDetectedError=UniqueViolationError=None
and return None early when they're unavailable. Optionally, keep asyncpg as an extra (basic-memory[postgres]) so SQLite users don't install a native Postgres driver at all.
Workaround for affected users today: turning Smart App Control off.
Activity
fix(core): stop SQLite startup importing asyncpg (basicmachines-co#2108)