MemPalace/mempalace · error · RebuildCleanupError

Post-recovery cleanup failed after {sum(counts.values())} ro

Error message

Post-recovery cleanup failed after {sum(counts.values())} rows were rebuilt: {exc}

What it means

Error "Post-recovery cleanup failed after {sum(counts.values())} rows were rebuilt: {exc}" thrown in MemPalace/mempalace.

Source

Thrown at mempalace/repair.py:2037

    # Bulk Chroma upserts can leave the derived FTS5 index internally
    # inconsistent even when all source rows landed.  Rebuild it only after
    # the backend releases its SQLite handle; otherwise VACUUM cannot obtain
    # the exclusive lock it needs on Windows.
    try:
        _vacuum_and_rebuild_fts5(dest_palace, strict=True)
    except Exception as exc:
        message_parts = [
            f"Post-recovery cleanup failed after {sum(counts.values())} rows were rebuilt: {exc}",
            f"Recovered palace retained at: {dest_palace}",
        ]
        if archive_path is not None:
            message_parts.append(f"Original palace remains archived at: {archive_path}")
        else:
            message_parts.append(f"Source palace is unchanged at: {source_palace}")
        message = "\n  ".join(message_parts)
        print(f"\n  ERROR: {message}")
        raise RebuildCleanupError(
            message,
            counts=dict(counts),
            dest_palace=dest_palace,
            archive_path=archive_path,
        ) from exc

    print(f"\n  Rebuild complete. {sum(counts.values())} total rows.")
    if archive_path is not None:
        print(f"  Original palace archived at: {archive_path}")
    print(f"{'=' * 55}\n")
    return counts


def status(palace_path=None, collection_name: Optional[str] = None) -> dict:
    """Read-only health check: compare sqlite vs HNSW element counts.

    Catches the #1222 failure mode where chromadb's HNSW segment freezes
    at a stale ``max_elements`` while sqlite keeps accumulating rows.

View on GitHub (pinned to 06cb6987f0)

Solutions

  1. Inspect the cleanup error; rebuilt rows are intact, finish cleanup manually

When it happens

Trigger: Thrown at mempalace/repair.py:2037 when the library encounters an invalid state.

Common situations: Cleanup after a successful rebuild failed.


AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15). Data as JSON: /api/errors/bc21683c1ed14ef6. Report an issue: GitHub.