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
Healthy project db silently quarantined to .corrupt and replaced with near-empty graph during concurrent CLI + multi-session MCP access (likely #391 family; correction in comments) #1037
A routine index_repository call on an already-indexed, healthy project silently discarded the existing graph and replaced it with a near-empty one — with status: "indexed" reported as success both times, no error, no warning.
Ran index_repository (mode: "fast") with no other activity in between — no kill signal, no binary swap, no relative path, no artifact export, no restart. Output reported success with the correct pre-existing counts (8,559 / 25,407) in that call's own log line.
Immediately after, the on-disk <project>.db was found renamed to <project>.db.corrupt (preserved, not deleted — this is an improvement over the unlink behavior in cbm v0.8.1 silently deletes project DBs on "corrupt" detection — data loss with no recovery #557, so the rename-on-corruption fix appears at least partially shipped). A new, near-empty<project>.db had been created in its place.
Subsequent searches against the "healthy" project now only see the new database. index_status on it reported 20 nodes / 19 edges.
Ran index_repository again (mode: "fast") on the small db — reported success, grew to a still-catastrophically-small graph.
Ran index_repository with mode: "full" explicitly, hoping for a clean rebuild — reported success, 784 nodes / 1,445 edges. Still nowhere near the original 8,559 / 25,407, despite the source repository being fully present and unchanged on disk (only two files had actually been edited since the last real index: a markdown doc and a config file — no source code changed).
Recovered by manually renaming <project>.db.corrupt back over the fresh <project>.db — index_status immediately reported the correct 8,559 / 25,407 again, confirming the original backup was structurally intact and just needed restoring.
Expected: index_repository on an already-indexed project with a small, non-code-affecting diff should either (a) do an incremental update preserving the existing graph, or (b) if it decides a full rebuild is warranted, actually rebuild the complete graph rather than silently producing a 90%+ smaller one while still reporting status: "indexed" / success.
Possible new clue: SQLite writer-version mismatch between the "corrupt" file and the fresh one
$ file <project>.db.corrupt
SQLite 3.x database, last written using SQLite version 3046000, page size 1,
file counter 1, database pages 356, cookie 0x1, schema 4, UTF-8, version-valid-for 1
$ file <project>.db # the fresh, near-empty replacement
SQLite 3.x database, last written using SQLite version 3051003, page size 1,
writer version 2, read version 2, file counter 3, database pages 68, cookie 0x6,
schema 4, UTF-8, version-valid-for 3
3046000 = SQLite 3.46.0, 3051003 = SQLite 3.51.3. The "corrupt" file was last written by a meaningfully older SQLite than the one the current codebase-memory-mcp binary links against. My guess: the original index was built by an earlier cbm release (before an update/reinstall bumped the bundled SQLite), and the current binary's integrity check treats that older on-disk format as corrupt on first touch, quarantines it, and silently starts fresh — landing squarely in the pattern #391 is tracking, but via a normal index_repository call with no crash/kill involved, which doesn't match any of the currently-listed sub-issues' trigger conditions.
Reproduction
I was not able to produce this from scratch on a synthetic/public repo — the trigger appears to require an index built by an oldercbm binary version than the one currently installed, which isn't something I can fabricate without actually having an older release on hand to build the initial index. Happy to attempt this if a maintainer can point me at which older release/commit would be useful to install first (e.g. a build linking SQLite 3.46.x), or if CBM_DIAGNOSTICS=1 output from a re-trigger would help — I'd rather not re-run this against my own project again without guidance since it destroyed the graph the first time and I've already restored from the .corrupt backup.
What I can confirm reproduced twice in a row, deterministically, on my actual project:
codebase-memory-mcp cli index_repository --repo-path <path> --mode fast on an already-indexed project → graph collapses to a fraction of its size, status: "indexed" still reported.
Repeating the same command against the now-small db → still small, still reports success.
--mode full on the now-small db → does not recover the original scale (784 vs. 8,559 nodes), despite the actual source tree being fully present and almost entirely unchanged.
Project shape (can't share the repository itself — private business codebase): TypeScript monorepo, 5 services (Next.js frontend, 2 Node backend services, a Python service, a shared package), several hundred source files.
No warning, error, or corruption-related log line preceded or accompanied the collapse — only the same mem.init / index.supervisor.reap outcome=clean exit_code=0 lines seen on every normal run. The .corrupt rename happened silently between calls.
Project scale (if relevant)
8,559 nodes / 25,407 edges → 20 nodes / 19 edges → 784 nodes / 1,445 edges (recovered to 8,559 / 25,407 by manually restoring the .corrupt backup)
My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code. Cannot confirm — see the Reproduction section for why, and what I'd need to produce one.
Environment
codebase-memory-mcp update -n)ui_enabled: true, binary ~273 MB)What happened, and what did you expect?
A routine
index_repositorycall on an already-indexed, healthy project silently discarded the existing graph and replaced it with a near-empty one — withstatus: "indexed"reported as success both times, no error, no warning.Sequence:
index_statusreportedstatus: "ready".index_repository(mode: "fast") with no other activity in between — no kill signal, no binary swap, no relative path, no artifact export, no restart. Output reported success with the correct pre-existing counts (8,559 / 25,407) in that call's own log line.<project>.dbwas found renamed to<project>.db.corrupt(preserved, not deleted — this is an improvement over theunlinkbehavior in cbm v0.8.1 silently deletes project DBs on "corrupt" detection — data loss with no recovery #557, so the rename-on-corruption fix appears at least partially shipped). A new, near-empty<project>.dbhad been created in its place.index_statuson it reported 20 nodes / 19 edges.index_repositoryagain (mode: "fast") on the small db — reported success, grew to a still-catastrophically-small graph.index_repositorywithmode: "full"explicitly, hoping for a clean rebuild — reported success, 784 nodes / 1,445 edges. Still nowhere near the original 8,559 / 25,407, despite the source repository being fully present and unchanged on disk (only two files had actually been edited since the last real index: a markdown doc and a config file — no source code changed).<project>.db.corruptback over the fresh<project>.db—index_statusimmediately reported the correct 8,559 / 25,407 again, confirming the original backup was structurally intact and just needed restoring.Expected:
index_repositoryon an already-indexed project with a small, non-code-affecting diff should either (a) do an incremental update preserving the existing graph, or (b) if it decides a full rebuild is warranted, actually rebuild the complete graph rather than silently producing a 90%+ smaller one while still reportingstatus: "indexed"/ success.Possible new clue: SQLite writer-version mismatch between the "corrupt" file and the fresh one
3046000= SQLite 3.46.0,3051003= SQLite 3.51.3. The "corrupt" file was last written by a meaningfully older SQLite than the one the currentcodebase-memory-mcpbinary links against. My guess: the original index was built by an earliercbmrelease (before anupdate/reinstall bumped the bundled SQLite), and the current binary's integrity check treats that older on-disk format as corrupt on first touch, quarantines it, and silently starts fresh — landing squarely in the pattern #391 is tracking, but via a normalindex_repositorycall with no crash/kill involved, which doesn't match any of the currently-listed sub-issues' trigger conditions.Reproduction
I was not able to produce this from scratch on a synthetic/public repo — the trigger appears to require an index built by an older
cbmbinary version than the one currently installed, which isn't something I can fabricate without actually having an older release on hand to build the initial index. Happy to attempt this if a maintainer can point me at which older release/commit would be useful to install first (e.g. a build linking SQLite 3.46.x), or ifCBM_DIAGNOSTICS=1output from a re-trigger would help — I'd rather not re-run this against my own project again without guidance since it destroyed the graph the first time and I've already restored from the.corruptbackup.What I can confirm reproduced twice in a row, deterministically, on my actual project:
codebase-memory-mcp cli index_repository --repo-path <path> --mode faston an already-indexed project → graph collapses to a fraction of its size,status: "indexed"still reported.--mode fullon the now-small db → does not recover the original scale (784 vs. 8,559 nodes), despite the actual source tree being fully present and almost entirely unchanged.Project shape (can't share the repository itself — private business codebase): TypeScript monorepo, 5 services (Next.js frontend, 2 Node backend services, a Python service, a shared package), several hundred source files.
Logs
No warning, error, or corruption-related log line preceded or accompanied the collapse — only the same
mem.init/index.supervisor.reap outcome=clean exit_code=0lines seen on every normal run. The.corruptrename happened silently between calls.Project scale (if relevant)
8,559 nodes / 25,407 edges → 20 nodes / 19 edges → 784 nodes / 1,445 edges (recovered to 8,559 / 25,407 by manually restoring the
.corruptbackup)Confirmations
index_repositoryon a healthy already-indexed project, no kill/restart/relative-path/artifact-export involved) doesn't match any currently-listed sub-issue, so filing separately per the existing triage pattern.