Repository navigation
Description
Bug Description
Hi !
Previous I had installed basic-memory 0.14.3, via homebrew and it was working perfectly. In fact, I still have this exactly same version installed in my work Mac and still works.
Then today I run brew upgrade basic-memory and during the install it showed this error:
==> Fetching downloads for: basic-memory
✔︎ Formula basic-memory (0.16.2) [Verified 1.1MB/ 1.1MB]
==> Installing basic-memory from basicmachines-co/basic-memory
==> uv tool install basic-memory==0.16.2 --no-cache
Error: Failed changing dylib ID of /opt/homebrew/Cellar/basic-memory/0.16.2/libexec/python/cpython-3.14.2-macos-aarch64-none/lib/itcl4.2.4/libitcl4.2.4.dylib
from libitcl4.2.4.dylib
to /opt/homebrew/opt/basic-memory/libexec/python/cpython-3.14.2-macos-aarch64-none/lib/itcl4.2.4/libitcl4.2.4.dylib
Error: Failed to fix install linkage
Updated load commands do not fit in the header of /opt/homebrew/Cellar/basic-memory/0.16.2/libexec/python/cpython-3.14.2-macos-aarch64-none/lib/itcl4.2.4/libitcl4.2.4.dylib. /opt/homebrew/Cellar/basic-memory/0.16.2/libexec/python/cpython-3.14.2-macos-aarch64-none/lib/itcl4.2.4/libitcl4.2.4.dylib needs to be relinked, possibly with -headerpad or -headerpad_max_install_names
The formula built, but you may encounter issues using it or linking other
formulae against it.
==> Caveats
Basic Memory has been installed as a command-line tool.
To get started:
basic-memory --help
For use with Claude Desktop, add to your claude_desktop_config.json:
https://memory.basicmachines.co/integrations/claude-desktop
==> Summary
🍺 /opt/homebrew/Cellar/basic-memory/0.16.2: 14,114 files, 176.8MB, built in 11 seconds
==> Running `brew cleanup basic-memory`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
Execution time: 14.62sAfter that, most of the commands I use (like write-note, read-note, even the --help ones), show the correct output, write the notes, but the process never finish, I need to Ctrl+C to finish it, then it show this error
^CException ignored while joining a thread in _thread._shutdown():
Traceback (most recent call last):
File "/opt/homebrew/Cellar/basic-memory/0.16.2/libexec/python/cpython-3.14.2-macos-aarch64-none/lib/python3.14/threading.py", line 1583, in _shutdown
_thread_shutdown()
KeyboardInterrupt:
No matter how long I wait, it hangs forever.
I tried to use Claude Code to help me to find the problem and it tried a lot of things, like install using uv tool, downgrading back to 0.14.3, reset the database, delete the database, installed forcing python 3.13, change some dependency versions.
Steps To Reproduce
Steps to reproduce the behavior:
- Install version 0.16.2, 0.16.1, 0.16.0, 0.15.0, 0.14.3
- Run command bm tool write-note --help and others. bm --help works without hang, for example
- Use tool/feature write-note, read-note
- See error
Expected Behavior
It should not hang and exit successfully
Actual Behavior
The output or action is performed but the control is never returned to the terminal, I need to Ctrl+C it. The problem is that when using inside Claude Code, it hangs forever stopping the flow.
Environment
basic-memory version: 0.14.3 (also affects 0.16.2)
- Installation method:
uv tool install basic-memory==0.14.3 - Python version: 3.13.7
- OS: macOS 26.1 (Sequoia) Build 25B78
- Architecture: ARM64 (Apple Silicon)
- pydantic version: 2.11.7
- fastmcp version: 2.10.2
Activity
phernandez commentedon Dec 16, 2025
hi @trystan2k when you say the commands hang, are you using the cli commands? or is the mcp hanging. If you can share any logs, that may be helpful. They will be in
~/.basic-memory/basic-memory-*.log
phernandez commentedon Dec 16, 2025
@claude can you investigate the issue the user is reporting?
claude commentedon Dec 16, 2025
Claude finished @phernandez's task in 5m 16s —— View job •
claude/issue-455-20251216-2004• Create PR ➔Investigation Complete ✅
Root Cause: Missing
awaiton task cancellation in FastAPI lifespan shutdown (src/basic_memory/api/app.py:69)Impact: CLI commands hang indefinitely when trying to exit after completing their work
The Problem
When CLI commands like
write-noteandread-noteexecute:get_client()context manager with ASGITransporttask.cancel()but doesn'tawaitthe taskThe Fix
Changed the lifespan shutdown to properly await task cancellation:
This follows the standard asyncio pattern for graceful task cancellation as documented in Python's asyncio documentation.
Why This Started in v0.15.1
SPEC-16 (#344) introduced proper async client context manager pattern. This made resource cleanup more correct, which exposed the pre-existing bug in the lifespan shutdown code that wasn't properly awaiting task cancellation.
Changes Made
await app.state.sync_taskafter cancellation (line 71-73)app.state.sync_task = Nonewhen sync is disabled (line 62)Testing Notes
The fix ensures that when the FastAPI lifespan context manager exits:
Branch |
[-][BUG][/-][+][BUG] Commands hang[/+]fix: await background sync task cancellation in lifespan shutdown
phernandez commentedon Dec 16, 2025
Thanks @trystan2k I'll see if I can get a bug fix release out really soon.
PR - #456
trystan2k commentedon Dec 16, 2025
basic-memory-api.log
Just to confirm, I am getting this when running as CLI, not MCP (didn't test with MCP).
I attached the only log file that is in the folder you mentioned, in case it still helps.
Thank you !