chroma icon indicating copy to clipboard operation
chroma copied to clipboard

[Bug]: collection.query RuntimeError: Cannot open header file

Open huanggefan opened this issue 1 year ago • 25 comments

What happened?

1. init data

  1. chroma_client = chromadb.PersistentClient(path=str(collection_dir))
  2. chroma_collection = chroma_client.get_or_create_collection(name=collection_name)
  3. add some data chroma_collection.upsert(ids=[id], embeddings=[embedding], documents=[document], metadatas=[metadata])
  4. stop this program

2. query and RuntimeError except

  1. collection.query(query_embeddings=query_embeddings, n_results=100)

3. remove index_metadata.pickle

  1. rm 64597cda-24ba-4d7a-8fc4-b96f1fc098d9/index_metadata.pickle

4. query and no RuntimeError except

5. restart program and query and RuntimeError except

6. remove index_metadata.pickle and restart program and query and RuntimeError no except

so, when index_metadata.pickle exists, will except RuntimeError

Versions

chromadb 0.4.2 python 3.11.4 windows 11

Relevant log output

Call function: query_result = collection.query(query_embeddings=query_embeddings, n_results=100)



File "python-env\Lib\site-packages\chromadb\api\models\Collection.py", line 223, in query
    return self._client._query(
           ^^^^^^^^^^^^^^^^^^^^
  File "python-env\Lib\site-packages\chromadb\api\segment.py", line 433, in _query
    vector_reader = self._manager.get_segment(collection_id, VectorReader)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "python-env\Lib\site-packages\chromadb\segment\impl\manager\local.py", line 112, in get_segment
    instance = self._instance(self._segment_cache[collection_id][scope])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "python-env\Lib\site-packages\chromadb\segment\impl\manager\local.py", line 131, in _instance
    instance = cls(self._system, segment)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "python-env\Lib\site-packages\chromadb\segment\impl\vector\local_persistent_hnsw.py", line 107, in __init__
    self._init_index(self._dimensionality)
  File "python-env\Lib\site-packages\chromadb\segment\impl\vector\local_persistent_hnsw.py", line 149, in _init_index
    index.load_index(
RuntimeError: Cannot open header file

huanggefan avatar Jul 25 '23 03:07 huanggefan