basic-memory CLI hangs after upgrade: KeyboardInterrupt in _thread._shutdown
After upgrading basic-memory to 0.17.4 on macOS (Homebrew Python 3.14),
basic-memory project listprints the projects table but then hangs and requires Ctrl-C, ending with "Exception ignored while joining a thread in _thread._shutdown(): KeyboardInterrupt".basic-memory --versionprints the version normally. Downgrading to 0.15.1 did not help. What causes the hang and how can I fix it?Originally asked on GitHub: https://github.com/basicmachines-co/basic-memory/issues/504
4 answers
Fixed in basic-memory 0.17.5 — the reporter confirmed the hang is gone after upgrading.
The maintainers found the actual root cause: CLI commands were calling
asyncio.run()directly instead of the project'srun_with_cleanup()helper, sodb.shutdown_db()was never called. The SQLite connection thread kept running and blocked interpreter shutdown on Python 3.14, producing the_thread._shutdown()KeyboardInterrupt traceback. The fix makes all CLI commands userun_with_cleanup(), bumps pydantic to>=2.12.0for official Python 3.14 support, and adds Python 3.14 to the SQLite CI test matrix.An earlier automated diagnosis blamed the FastAPI lifespan starting background file-watching tasks via ASGI transport; the maintainers verified that ASGI transport does NOT trigger the FastAPI lifespan, so that was not the cause.
To fix, upgrade and retry:
uv tool upgrade basic-memory basic-memory project listThe reporter was on macOS 15.7.2 with Homebrew Python 3.14. Downgrading to 0.15.1 did not help, so upgrade to 0.17.5 or later.
Did this work for you?What @rmoff tried on GitHub (Worked)
Upgraded to v0.17.5 after the maintainer suggested trying it, and confirmed the CLI commands no longer hang.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Upgraded to 0.17.4 with
uv tool upgrade basic-memory;basic-memory --versionprinted the version normally, butbasic-memory project listprinted the table and then hung until Ctrl-C, showing the_thread._shutdown()KeyboardInterrupt traceback.Source: https://github.com/basicmachines-co/basic-memory/issues/504 (opens external site)
Did this work for you?What @rmoff tried on GitHub (Didn't work)
Downgraded to 0.15.1 with
uv tool install basic-memory==0.15.1and moved~/.basic-memoryaside;basic-memory project liststill hung and had to be cancelled.Did this work for you?
Related questions
- basic-memory MCP: ai_assistant_guide resource not found (No such file or directory)
- basic-memory write_note drops custom frontmatter from content
- Basic Memory 0.12.0: write_note fails with sqlite3.OperationalError no such table: entity
- Does basic-memory MCP support Docker with an Obsidian vault mounted via volume?
- Why doesn't basic-memory offer discovery meta-tools like list_categories and list_tags?