From bd5996f41ec495adfc8575fbadf6c3435f2af821 Mon Sep 17 00:00:00 2001 From: Hrushikesh Yadav <136978914+HrushiYadav@users.noreply.github.com> Date: Mon, 22 Jun 2026 11:57:52 +0530 Subject: [PATCH] fix(pinecone): return [[]] from list() error path instead of dict (#5706) --- mem0/vector_stores/pinecone.py | 2 +- tests/vector_stores/test_pinecone.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mem0/vector_stores/pinecone.py b/mem0/vector_stores/pinecone.py index 91be9efdb..733db6ca8 100644 --- a/mem0/vector_stores/pinecone.py +++ b/mem0/vector_stores/pinecone.py @@ -391,7 +391,7 @@ class PineconeDB(VectorStoreBase): return [results] except Exception as e: logger.error(f"Error listing vectors: {e}") - return {"points": [], "next_page_token": None} + return [[]] def count(self) -> int: """ diff --git a/tests/vector_stores/test_pinecone.py b/tests/vector_stores/test_pinecone.py index 89194aea1..06980fe82 100644 --- a/tests/vector_stores/test_pinecone.py +++ b/tests/vector_stores/test_pinecone.py @@ -188,3 +188,11 @@ def test_count_with_none_vector_count(pinecone_db): count = pinecone_db.count() assert count == 0 pinecone_db.index.describe_index_stats.assert_called_once() + + +def test_list_error_returns_list_not_dict(pinecone_db): + """list() error path must return [[]] so callers can do result[0].""" + pinecone_db.index.query.side_effect = Exception("connection error") + result = pinecone_db.list(filters={"user_id": "alice"}, top_k=10) + assert isinstance(result, list) + assert result == [[]]