MemPalace/mempalace · critical · EmbedderIdentityMismatchError
collection was built with embedder {stored.model_name!r} but
Error message
collection was built with embedder {stored.model_name!r} but the current embedder is {current.model_name!r}. Searching across a model swap silently degrades recall. Re-embed the palace, or run `mempalace palace set-embedder --model <name> --force` to record the new identity if you know the vectors are compatible. What it means
Raised as TruncationDetected when the on-disk chroma.sqlite3 reports more embedding rows than the chromadb collection layer returned during extraction. This means the segment metadata is stale (classically after a manual HNSW quarantine), and proceeding with a rebuild would silently destroy the difference. It is a load-bearing safety abort that protects against data loss.
Source
Thrown at mempalace/backends/base.py:239
dim_conflict = bool(stored.dimension and current.dimension) and (
stored.dimension != current.dimension
)
name_conflict = stored.model_name != current.model_name
if not dim_conflict and not name_conflict:
return "known_match"
if force_model_swap:
return "known_mismatch"
if dim_conflict:
raise DimensionMismatchError(
f"collection was built with a {stored.dimension}-dim embedder "
f"({stored.model_name!r}) but the current embedder is "
f"{current.dimension}-dim ({current.model_name!r}); the stored "
"vectors are incompatible. Re-embed the palace to switch models."
)
raise EmbedderIdentityMismatchError(
f"collection was built with embedder {stored.model_name!r} but the "
f"current embedder is {current.model_name!r}. Searching across a model "
"swap silently degrades recall. Re-embed the palace, or run "
"`mempalace palace set-embedder --model <name> --force` to record the "
"new identity if you know the vectors are compatible."
)
@dataclass(frozen=True)
class HealthStatus:
ok: bool
detail: str = ""
@classmethod
def healthy(cls, detail: str = "") -> "HealthStatus":
return cls(ok=True, detail=detail)
@classmethodView on GitHub (pinned to 06cb6987f0)
Solutions
- Restore the palace from your most recent backup, then re-mine — safest path.
- Direct-extract rows from chroma.sqlite3 (extract_via_sqlite exists for this) and rebuild the palace from the recovered rows plus source files.
- Only if you have independently verified (direct sqlite3 COUNT query) that the palace truly contains only {extracted} drawers, re-run with --confirm-truncation-ok.
Example fix
# before
repair.check_extraction_safety(palace_path, extracted=5, sqlite_count=10_000)
# raises TruncationDetected
# after (only after verifying via sqlite3)
repair.check_extraction_safety(palace_path, extracted=5, sqlite_count=5,
confirm_truncation_ok=True) Defensive patterns
Strategy: validation
Validate before calling
from mempalace import repair
count = repair.sqlite_drawer_count(palace_path)
if count is not None:
extracted = len(list(repair.extract_via_sqlite(palace_path, 'drawers')))
assert extracted >= count or independently_verified, 'truncation risk' Try / catch
try:
repair.check_extraction_safety(palace_path, extracted, confirm_truncation_ok=False)
except repair.TruncationDetected as e:
# e carries sqlite_count and extracted — decide recovery vs confirm
if verified_true_count(e.extracted):
rerun_with_confirm()
else:
restore_from_backup_or_sqlite_extract() Prevention
- Never manually quarantine/move HNSW segment files while chromadb is running.
- Keep regular palace backups before repairs.
- Run repairs with no other process holding the palace open so the SQLite cross-check works.
When it happens
Trigger: check_extraction_safety() in repair.py finds sqlite_count > extracted without confirm_truncation_ok=True. Typical after an HNSW index quarantine or a chromadb version change that leaves segment metadata inconsistent with the embeddings table.
Common situations: Running `mempalace rebuild` / repair after manually moving HNSW segment files, after a chromadb upgrade with segment drift, or against a palace that was copied while chromadb held it open.
Related errors
- backend does not support facet_counts
- collection was built with a {stored.dimension}-dim embedder
- backend does not support maintenance kind {kind!r}
- backend does not support lexical_search
- {type(self).name} does not advertise supports_namespace_isol
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/a68daf7858b2c520.
Report an issue: GitHub.