Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix: add input validation to search_by_id method (#209)
bot7773be6d0acd390
diff --git a/openviking/storage/vectordb/collection/local_collection.py b/openviking/storage/vectordb/collection/local_collection.pyindex 39ab4b6cb..87914eecd 100644--- a/openviking/storage/vectordb/collection/local_collection.py+++ b/openviking/storage/vectordb/collection/local_collection.py@@ -337,8 +337,22 @@ class LocalCollection(ICollection):) -> SearchResult:if not self.store_mgr:raise RuntimeError("Store manager is not initialized")- pk = self.meta.primary_key- label = str_to_uint64(str(id)) if pk != AUTO_ID_KEY else int(id)++ # Validate input ID+ if id is None:+ return SearchResult()++ # Handle empty string IDs+ if isinstance(id, str) and not id.strip():+ return SearchResult()++ try:+ pk = self.meta.primary_key+ label = str_to_uint64(str(id)) if pk != AUTO_ID_KEY else int(id)+ except (ValueError, OverflowError) as e:+ # Invalid ID format - return empty result instead of crashing+ return SearchResult()+cands_list: List[CandidateData] = self.store_mgr.fetch_cands_data([label])if not cands_list or cands_list[0] is None:return SearchResult()