agentscope-ai/agentscope · warning · NotImplementedError

{type(self).__name__} does not implement list_chunks().

Error message

{type(self).__name__} does not implement list_chunks().

What it means

VectorStoreBase.list_chunks() is an optional API; this base-class default raises NotImplementedError naming the backend that doesn't support chunk listing.

Source

Thrown at src/agentscope/rag/_vdb/_vector_store.py:352

                Maximum number of chunks to return.
            metadata_filter (`dict[str, Any] | None`, optional):
                If provided, restrict listing to records whose
                ``chunk.metadata`` matches every ``key == value`` pair
                in this dict.  Used for defense-in-depth cross-tenant
                scoping when an isolation strategy co-locates multiple
                knowledge bases inside the same collection.

        Returns:
            `list[Chunk]`:
                At most ``limit`` chunks ordered by ``chunk_index``
                ascending; empty when the document has no records or
                ``offset`` is past the end.

        Raises:
            `NotImplementedError`:
                If the backend does not support chunk listing.
        """
        raise NotImplementedError(
            f"{type(self).__name__} does not implement list_chunks().",
        )

View on GitHub (pinned to e90f1c7592)

Solutions

  1. Implement list_chunks in your subclass (page through stored documents and their chunks)
  2. Use a backend that supports it (e.g. the built-in MongoDB/Elasticsearch stores)
  3. Gate feature detection with hasattr or try/except NotImplementedError

Example fix

# before
class MyStore(VectorStoreBase): ...
chunks = await store.list_chunks('coll')
# after
class MyStore(VectorStoreBase):
    async def list_chunks(self, collection, document_id=None, offset=0, limit=10):
        ...
chunks = await store.list_chunks('coll')
Defensive patterns

Strategy: type-guard

Validate before calling

supports = hasattr(store, 'list_chunks') and type(store).list_chunks is not VectorStoreBase.list_chunks

Type guard

def supports_list_chunks(store) -> bool:
    return type(store).list_chunks is not VectorStoreBase.list_chunks

Try / catch

try:
    chunks = await store.list_chunks(coll)
except NotImplementedError:
    chunks = []

Prevention

When it happens

Trigger: Calling list_chunks() on a vector store subclass that never overrode it (e.g. a minimal custom backend), often via retrieval UIs or export tooling.

Common situations: Writing a custom VectorStoreBase subclass and only implementing insert/search/query; generic code that iterates stored chunks hits the stub.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28). Data as JSON: /api/errors/1f30224e1d453ce2. Report an issue: GitHub.