Skip to content

Parallel mining corrupts ChromaDB HNSW index — no warning, silent failure #357

@fubak

Description

@fubak

Bug

Running mempalace mine on two projects simultaneously against the same palace corrupts the ChromaDB HNSW index. Mining appears to succeed (no errors during the mine), but subsequent searches and even new writes fail with an unrecoverable error.

Steps to Reproduce

# Mine two projects in parallel against the same palace
mempalace mine /path/to/project1 --wing project1 &
mempalace mine /path/to/project2 --wing project2 &
wait

# Both appear to complete without error, then:
mempalace search "anything" --wing project1
# → Search error: Error loading hnsw index

# Even re-mining fails:
mempalace mine /path/to/project1 --wing project1
# → chromadb.errors.InternalError: Error in compaction:
#   Error constructing hnsw segment reader:
#   Error creating hnsw segment reader: Error loading hnsw index

Impact

  • Index corruption is unrecoverable — the only fix is to delete the entire palace and re-mine everything from scratch
  • Mining itself reports no errors, giving false confidence that it succeeded
  • All previously working wings in the palace are unaffected for reads, but new writes also fail — making the palace permanently read-only until wiped

Expected

Either:

  1. Lock the palace during mining to prevent concurrent writes, or
  2. Detect concurrent access and exit with a clear error

At minimum, document that parallel mining is unsupported.

Full Traceback

File ".../mempalace/miner.py", line 207, in add_drawer
    collection.add(...)
chromadb.errors.InternalError: Error in compaction: Error constructing hnsw segment reader: Error creating hnsw segment reader: Error loading hnsw index

Environment

  • mempalace 3.0.0
  • Python 3.12.3
  • ChromaDB 1.5.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/miningFile and conversation miningbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions