tool_status() called _get_collection() with the default create=False, which throws when the ChromaDB collection does not exist yet (valid palace, zero drawers). The exception was swallowed and status returned "No palace found" even though init had completed successfully. Switching to create=True bootstraps an empty collection on first status call, matching what the write path already does. Fix suggested by @hkevinchu in the issue.
This commit is contained in:
committed by
GitHub
parent
f20f45a2da
commit
54a386d925
@@ -269,7 +269,11 @@ def _sanitize_optional_name(value: str = None, field_name: str = "name") -> str:
|
||||
|
||||
|
||||
def tool_status():
|
||||
col = _get_collection()
|
||||
# Use create=True only when a palace DB already exists on disk -- this
|
||||
# bootstraps the ChromaDB collection on a valid-but-empty palace without
|
||||
# accidentally creating a palace in a non-existent directory (#830).
|
||||
db_exists = os.path.isfile(os.path.join(_config.palace_path, "chroma.sqlite3"))
|
||||
col = _get_collection(create=db_exists)
|
||||
if not col:
|
||||
return _no_palace()
|
||||
count = col.count()
|
||||
|
||||
Reference in New Issue
Block a user