Pi agent crashes after installing codebase-memory-mcp: Cannot read properties of undefined (reading 'properties')
After running the codebase-memory-mcp 0.10.8 installer (
curl ... install.sh | bash) on a machine with pi (@earendil-works/pi-coding-agent0.84.2/0.84.3), every new pi session crashes withError: Cannot read properties of undefined (reading 'properties'). The installer writes~/.pi/agent/extensions/cbmem.ts, and deleting that file restores pi to working state. Reproduced on Windows 11, Linux, and macOS.Originally asked on GitHub: https://github.com/DeusData/codebase-memory-mcp/issues/1806
5 answers
Fixed in v0.10.9 (maintainer-confirmed; commits on
maininclude merge 9b103379 / PR #1809, plus PR #1858). The installer-generated Pi extension at~/.pi/agent/extensions/cbmem.tsregistered tools aspi.registerTool({ name, run }), but Pi'sregisterToolAPI requires a TypeBoxparametersschema and anexecutecallback. Pi's loader readstool.parameters.properties, which wasundefined, so every session crashed at startup — and on some versions every tool call failed with the same error, even during system-prompt construction. Direct CLI use (codebase-memory-mcp cli list_projects '{}') kept working, confirming the server/index were healthy.To fix:
- Update codebase-memory-mcp to v0.10.9 (or build from
main). - Run
codebase-memory-mcp installonce — it regenerates~/.pi/agent/extensions/cbmem.tswithlabel,description,parameters(TypeBoxType.Objectschemas emitted from the tool registry), andexecute(toolCallId, params, signal, onUpdate, ctx)returning{ content, details }. The oldrun:shape is gone, with a regression test rejecting it. - If you hand-edited the file or stripped its auto-generated markers, delete
~/.pi/agent/extensions/cbmem.tsfirst so the installer can write the new block.
Before the fix shipped, two local workarounds worked: delete
cbmem.tsto restore pi (the CBM tools disappear), or rewrite the file with a valid schema — either derived from the MCPtools/listinputSchema, or a permissiveType.Object({}, { additionalProperties: true })— and replacerun:withasync execute(...). Security note: since the fix, tool arguments travel over stdin (cli --json <tool>) instead of argv, keeping payloads out of process listings.Did this work for you?- Update codebase-memory-mcp to v0.10.9 (or build from
What a GitHub user tried on GitHub (Worked)
Reporter deleted
~/.pi/agent/extensions/cbmem.ts; pi returned to working state (the codebase-memory tools are no longer registered, but the startup crash is gone).Source: https://github.com/DeusData/codebase-memory-mcp/issues/1806 (opens external site)
Did this work for you?What @madebymlai tried on GitHub (Worked)
Rewrote cbmem.ts to generate
parametersdirectly from the MCPtools/listresponse (inputSchema) and register tools withasync execute(...)returning{ content, details }; after/reloador restarting pi the schema error was gone.Did this work for you?What @goodends tried on GitHub (Worked)
Rewrote cbmem.ts with a permissive shared schema
Type.Object({}, { additionalProperties: true }), the correctexecutesignature, and stripped the auto-generated// codebase-memory-mcp:start/:endmarkers so future installs don't clobber the fix; verified locally on pi 0.84.3.Did this work for you?What @bdunks tried on GitHub (Worked)
Built codebase-memory-mcp from
mainafter the fix (PR #1858) and confirmed the issue no longer occurs; reporter expected it in the next release.Did this work for you?
Related questions
- codebase-memory-mcp cli search_code returns "search failed: temp file" on Windows
- Claude Code hook blocks every Read instead of once per session, how to fix?
- search_code always returns 0 results – ripgrep invoked without explicit path
- Does codebase-memory-mcp support PowerShell (.ps1, .psm1, .psd1) files?
- codebase-memory-mcp install/update fails with 'active CBM sessions could not be stopped safely' after killed processes