{"record":{"id":"25a9dd732be4aea6","repo":"MemPalace/mempalace","slug":"recovered-palace-has-no-sqlite-database-sqlite-p","errorCode":null,"errorMessage":"recovered palace has no SQLite database: {sqlite_path}","messagePattern":"recovered palace has no SQLite database: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"mempalace/repair.py","lineNumber":1071,"sourceCode":") -> None:\n    \"\"\"VACUUM the palace SQLite file and rebuild the FTS5 index if present.\n\n    Repeated ``repair --yes`` runs delete and recreate the drawers collection,\n    leaving freed SQLite pages unreclaimable without an explicit VACUUM.  The\n    FTS5 virtual table (``embedding_fulltext_search``) can also become\n    internally inconsistent after multiple collection deletes; the rebuild\n    command fixes it atomically without touching any row data.\n\n    Existing repair paths use the default best-effort behavior: failures log a\n    warning and return because their primary rebuild has already succeeded.\n    SQLite recovery passes ``strict=True`` because its bulk upserts can leave\n    this derived index malformed; that path must not report success until the\n    rebuild, VACUUM, and a final quick_check all complete.\n    \"\"\"\n    sqlite_path = os.path.join(palace_path, \"chroma.sqlite3\")\n    if not os.path.exists(sqlite_path):\n        if strict:\n            raise FileNotFoundError(f\"recovered palace has no SQLite database: {sqlite_path}\")\n        return\n    try:\n        with closing(sqlite3.connect(sqlite_path, isolation_level=None)) as conn:\n            tables = {\n                r[0] for r in conn.execute(\"SELECT name FROM sqlite_master WHERE type='table'\")\n            }\n            if \"embedding_fulltext_search\" in tables:\n                conn.execute(\n                    \"INSERT INTO embedding_fulltext_search\"\n                    \"(embedding_fulltext_search) VALUES('rebuild')\"\n                )\n                conn.commit()\n                progress(\"  FTS5 index rebuilt.\")\n            conn.execute(\"VACUUM\")\n            progress(\"  SQLite VACUUM complete.\")\n            if strict:\n                rows = conn.execute(\"PRAGMA quick_check\").fetchall()\n                errors = [str(row[0]) for row in rows if row and str(row[0]).lower() != \"ok\"]","sourceCodeStart":1053,"sourceCodeEnd":1089,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/repair.py#L1053-L1089","documentation":"Error \"recovered palace has no SQLite database: {sqlite_path}\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/repair.py:1071 when the library encounters an invalid state.","commonSituations":"Recovered palace directory is missing its SQLite database.","solutions":["Restore the SQLite database from backup before running repair"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}