From b23bad32c3d2b3312f0c67f2dc8c5364f33e2e11 Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Fri, 24 Apr 2026 15:32:06 +0300 Subject: [PATCH] Check table_names() before dropping chunks in recreate_embeddings_table --- haiku_rag_slim/haiku/rag/store/engine.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/haiku_rag_slim/haiku/rag/store/engine.py b/haiku_rag_slim/haiku/rag/store/engine.py index f57dc94d..f4204efe 100644 --- a/haiku_rag_slim/haiku/rag/store/engine.py +++ b/haiku_rag_slim/haiku/rag/store/engine.py @@ -586,11 +586,12 @@ class Store: ReadOnlyError: If the store is in read-only mode. """ self._assert_writable() - # Drop and recreate chunks table - try: + # Drop and recreate chunks table. Check existence first rather than + # catching-and-swallowing drop_table's errors — a catch-all would + # hide real failures (permissions, storage-backend errors) and then + # the subsequent create_table would fail confusingly. + if "chunks" in await self.db.table_names(): await self.db.drop_table("chunks") - except Exception: - pass # Update the ChunkRecord model with new vector dimension self.ChunkRecord = create_chunk_model(self.embedder._vector_dim)