Skip to content

[Bug]: NPE in local_collection.py when invoke find method #189

@shoocstorm

Description

@shoocstorm

Bug Description

Hi Team,
Appreciate if you could take a look below NPE.

It seems it could return empty cands_list and subsquently results in NPE in cand.fields in local_collection.py.

293 cands_list = self.store_mgr.fetch_cands_data(label_list) 294 cands_fields = [json.loads(cand.fields) for cand in cands_list]

Best Regards

Steps to Reproduce

invoke the find method of ov client

Expected Behavior

No NPE

Actual Behavior

NPE thrown

Minimal Reproducible Example

Error Logs

[0] [2026-02-14 15:49:44.119 +0000] DEBUG (Javis-Logger): [agent:Javis] start - Retrieving context | user=Master | conv=Bot-UI-CONV-2026-02-14T15-49-28-978Z | exec=bfa30cb4-5a37-4346-aad1-983ed9087105
[0]     agentId: "JavisBot"
[0]     modelName: "dynamic"
[0]     operationId: "bfa30cb4-5a37-4346-aad1-983ed9087105"
[0]     userId: "Master"
[0]     conversationId: "Bot-UI-CONV-2026-02-14T15-49-28-978Z"
[0]     executionId: "bfa30cb4-5a37-4346-aad1-983ed9087105"
[0]     operation: "retriever"
[0]     retrieverId: "openviking_search"
[0]     event: "retriever.search.started"
[0]     input: "What is FSA account?"
[0] [2026-02-14 15:49:44.119 +0000] DEBUG (Javis-Logger): [RAG QUERY] Starting retrieval for query: "What is FSA account?" in viking://resources/README.md
[0] [2026-02-14 15:49:44.746 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] 2026-02-14 23:49:44,745 - httpx - INFO - HTTP Request: POST http://127.0.0.1:1234/v1/embeddings "HTTP/1.1 200 OK"
[0] [2026-02-14 15:49:44.750 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] 2026-02-14 23:49:44,750 - openviking.storage.viking_vector_index_backend - ERROR - Error searching collection 'context': 'NoneType' object has no attribute 'fields'
[0] [2026-02-14 15:49:44.750 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] Traceback (most recent call last):
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]   File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openviking/utils/async_utils.py", line 27, in run_async
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]     loop = asyncio.get_running_loop()
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]            ^^^^^^^^^^^^^^^^^^^^^^^^^^
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] RuntimeError: no running event loop
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] During handling of the above exception, another exception occurred:
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] Traceback (most recent call last):
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]   File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openviking/storage/viking_vector_index_backend.py", line 654, in search
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]     result = coll.search_by_vector(
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]              ^^^^^^^^^^^^^^^^^^^^^^
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]   File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openviking/storage/vectordb/collection/collection.py", line 327, in search_by_vector
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]     return self.__collection.search_by_vector(
[0] [2026-02-14 15:49:44.751 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[0] [2026-02-14 15:49:44.752 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]   File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/openviking/storage/vectordb/collection/local_collection.py", line 294, in search_by_vector
[0] [2026-02-14 15:49:44.752 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]     cands_fields = [json.loads(cand.fields) for cand in cands_list]
[0] [2026-02-14 15:49:44.752 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE]                                ^^^^^^^^^^^
[0] [2026-02-14 15:49:44.752 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] AttributeError: 'NoneType' object has no attribute 'fields'
[0] [2026-02-14 15:49:44.752 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] 2026-02-14 23:49:44,752 - openviking.storage.viking_vector_index_backend - ERROR - Error searching collection 'context': 'NoneType' object has no attribute 'fields'
[0] [2026-02-14 15:49:44.753 +0000] DEBUG (Javis-Logger): [PYTHON BRIDGE] Traceback (most recent call last):

OpenViking Version

0.1.12

Python Version

3.12.9

Operating System

macOS

Model Backend

Other

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions