JaydeepR Claude Sonnet 4.6 commited on
Commit
3e90306
·
1 Parent(s): 1049372

Fix ChromaDB tenant error on stale .chroma directory

Browse files

When the .chroma directory exists from an older ChromaDB version, PersistentClient
raises ValueError about missing default_tenant. Catch it, wipe the directory,
and recreate — data is regenerated on the next evaluation run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. core/vectorstore.py +7 -1
core/vectorstore.py CHANGED
@@ -7,8 +7,14 @@ from core.config import CHROMA_DIR
7
 
8
  @st.cache_resource
9
  def get_client():
 
10
  import chromadb
11
- return chromadb.PersistentClient(path=CHROMA_DIR)
 
 
 
 
 
12
 
13
 
14
  def get_collection(name: str):
 
7
 
8
  @st.cache_resource
9
  def get_client():
10
+ import shutil
11
  import chromadb
12
+ try:
13
+ return chromadb.PersistentClient(path=CHROMA_DIR)
14
+ except ValueError:
15
+ # Stale or version-incompatible .chroma directory — wipe and recreate
16
+ shutil.rmtree(CHROMA_DIR, ignore_errors=True)
17
+ return chromadb.PersistentClient(path=CHROMA_DIR)
18
 
19
 
20
  def get_collection(name: str):