{"record":{"id":"64fc0a0287c49d51","repo":"MemPalace/mempalace","slug":"fts5-sqlite-quick-check-failed-len-errors-issu","errorCode":null,"errorMessage":"FTS5/SQLite quick_check failed: {len(errors)} issue(s)","messagePattern":"FTS5/SQLite quick_check failed: (.+?) issue\\(s\\)","errorType":"exception","errorClass":"MineValidationError","httpStatus":null,"severity":"error","filePath":"mempalace/palace.py","lineNumber":1151,"sourceCode":"    # Defer-import: keeps the repair module graph out of mine's hot import path.\n    from .repair import _close_chroma_handles, maybe_autoheal_fts5_index, sqlite_integrity_errors\n\n    # Pass the live singleton so the writer's cached PersistentClient actually\n    # gets closed and WAL flushes before the read-only sqlite3 re-open.\n    # A transient ChromaBackend (the default) would only clear its own empty\n    # `_clients` dict and leave _DEFAULT_BACKEND's live handle in place,\n    # which on Windows keeps the sqlite file mmap'd.\n    _close_chroma_handles(palace_path, backend=_DEFAULT_BACKEND)\n\n    errors = sqlite_integrity_errors(palace_path)\n    if errors:\n        # progress=logger.info, not the default print: this runs inside the\n        # MCP server process too (mcp_server.tool_mine -> miner.mine), where\n        # stdout is the JSON-RPC transport -- a stray print() here would\n        # corrupt the protocol stream and crash the connection.\n        errors = maybe_autoheal_fts5_index(palace_path, errors, progress=logger.info)\n    if errors:\n        raise MineValidationError(palace_path, errors)\n\n\n# Process-wide record of palaces this PROCESS already holds the lock for. Used\n# by `mine_palace_lock` to short-circuit re-entrant acquisition from the same\n# process (e.g. miner.mine() acquires the outer lock then calls\n# ChromaCollection.upsert which now also tries to acquire). Without this guard\n# the inner call would block on its own outer flock (Linux fcntl locks are per\n# open file description, so a second open of the lock file from the same process\n# is a distinct lock and self-conflicts / EWOULDBLOCKs).\n#\n# This MUST be process-wide, not thread-local: the MCP HTTP transport\n# (ThreadingHTTPServer) acquires the long-lived writer-lease on one thread\n# (`mcp_server._acquire_mcp_writer_lock`) but dispatches each write request on a\n# different worker thread. A thread-local guard makes those handlers fail to see\n# the process-held lease, re-acquire the flock, and self-conflict\n# (\"palace ... is held by PID <self>\"). flock is per-process and HTTP writes are\n# serialized by `_HTTP_REQUEST_LOCK`, so the process is the correct re-entrancy\n# boundary.","sourceCodeStart":1133,"sourceCodeEnd":1169,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/palace.py#L1133-L1169","documentation":"Error \"FTS5/SQLite quick_check failed: {len(errors)} issue(s)\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/palace.py:1151 when the library encounters an invalid state.","commonSituations":"SQLite FTS5 integrity check reported corruption.","solutions":["Run palace repair; restore from backup if quick_check keeps failing"],"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"}