{"record":{"id":"1f30224e1d453ce2","repo":"agentscope-ai/agentscope","slug":"type-self-name-does-not-implement-list-chun","errorCode":null,"errorMessage":"{type(self).__name__} does not implement list_chunks().","messagePattern":"(.+?) does not implement list_chunks\\(\\)\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"warning","filePath":"src/agentscope/rag/_vdb/_vector_store.py","lineNumber":352,"sourceCode":"                Maximum number of chunks to return.\n            metadata_filter (`dict[str, Any] | None`, optional):\n                If provided, restrict listing to records whose\n                ``chunk.metadata`` matches every ``key == value`` pair\n                in this dict.  Used for defense-in-depth cross-tenant\n                scoping when an isolation strategy co-locates multiple\n                knowledge bases inside the same collection.\n\n        Returns:\n            `list[Chunk]`:\n                At most ``limit`` chunks ordered by ``chunk_index``\n                ascending; empty when the document has no records or\n                ``offset`` is past the end.\n\n        Raises:\n            `NotImplementedError`:\n                If the backend does not support chunk listing.\n        \"\"\"\n        raise NotImplementedError(\n            f\"{type(self).__name__} does not implement list_chunks().\",\n        )\n","sourceCodeStart":334,"sourceCodeEnd":355,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/rag/_vdb/_vector_store.py#L334-L355","documentation":"VectorStoreBase.list_chunks() is an optional API; this base-class default raises NotImplementedError naming the backend that doesn't support chunk listing.","triggerScenarios":"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.","commonSituations":"Writing a custom VectorStoreBase subclass and only implementing insert/search/query; generic code that iterates stored chunks hits the stub.","solutions":["Implement list_chunks in your subclass (page through stored documents and their chunks)","Use a backend that supports it (e.g. the built-in MongoDB/Elasticsearch stores)","Gate feature detection with hasattr or try/except NotImplementedError"],"exampleFix":"# before\nclass MyStore(VectorStoreBase): ...\nchunks = await store.list_chunks('coll')\n# after\nclass MyStore(VectorStoreBase):\n    async def list_chunks(self, collection, document_id=None, offset=0, limit=10):\n        ...\nchunks = await store.list_chunks('coll')","handlingStrategy":"type-guard","validationCode":"supports = hasattr(store, 'list_chunks') and type(store).list_chunks is not VectorStoreBase.list_chunks","typeGuard":"def supports_list_chunks(store) -> bool:\n    return type(store).list_chunks is not VectorStoreBase.list_chunks","tryCatchPattern":"try:\n    chunks = await store.list_chunks(coll)\nexcept NotImplementedError:\n    chunks = []","preventionTips":["Implement all optional store methods in custom subclasses","Feature-detect optional backend capabilities"],"tags":["not-implemented","vector-store","subclassing"],"backgroundTag":"unsupported-operation","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}