{"record":{"id":"bcc12b6f2d02bfdb","repo":"deepset-ai/haystack","slug":"document-store-type-self-document-store-name-bcc12b","errorCode":null,"errorMessage":"Document store {type(self.document_store).__name__} does not provide async support.","messagePattern":"Document store (.+?) does not provide async support\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"haystack/components/writers/document_writer.py","lineNumber":124,"sourceCode":"        but can be used with `await` in async code.\n\n        :param documents:\n            A list of documents to write to the document store.\n        :param policy:\n            The policy to use when encountering duplicate documents.\n        :returns:\n            Number of documents written to the document store.\n\n        :raises ValueError:\n            If the specified document store is not found.\n        :raises TypeError:\n            If the specified document store does not implement `write_documents_async`.\n        \"\"\"\n        if policy is None:\n            policy = self.policy\n\n        if not hasattr(self.document_store, \"write_documents_async\"):\n            raise TypeError(f\"Document store {type(self.document_store).__name__} does not provide async support.\")\n\n        documents_written = await self.document_store.write_documents_async(documents=documents, policy=policy)\n        return {\"documents_written\": documents_written}\n\n    def close(self) -> None:\n        \"\"\"\n        Release the synchronous resources of the underlying Document Store.\n        \"\"\"\n        if hasattr(self.document_store, \"close\"):\n            self.document_store.close()\n\n    async def close_async(self) -> None:\n        \"\"\"\n        Release the asynchronous resources of the underlying Document Store.\n        \"\"\"\n        if hasattr(self.document_store, \"close_async\"):\n            await self.document_store.close_async()\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/writers/document_writer.py#L106-L142","documentation":"DocumentWriter.run_async requires the configured document store to implement write_documents_async. If the store object lacks that attribute, a TypeError is raised because the async write cannot be performed. The sync run() works with the same store; only the async path is affected.","triggerScenarios":"Awaiting DocumentWriter.run_async (or running an async pipeline containing it) when self.document_store is an InMemoryDocumentStore or any custom/legacy store that doesn't define write_documents_async.","commonSituations":"Using InMemoryDocumentStore (no async support) in an async pipeline; custom DocumentStore implementations that only ported the sync API; older third-party store integrations predating the async API.","solutions":["Use an async-capable document store (e.g. a store that implements write_documents_async) instead of InMemoryDocumentStore.","Fall back to the synchronous DocumentWriter.run() in async code via asyncio.to_thread(run, ...) if the store has no async support.","If it's a custom store, implement write_documents_async (often trivially wrapping write_documents or an async client call).","Upgrade the document store integration package to a version that adds async write support."],"exampleFix":"// before\nwriter = DocumentWriter(document_store=InMemoryDocumentStore())\nawait writer.run_async(documents=docs)\n// after\nwriter = DocumentWriter(document_store=QdrantDocumentStore(url=...))  # supports write_documents_async\nawait writer.run_async(documents=docs)","handlingStrategy":"type-guard","validationCode":"if not hasattr(writer.document_store, \"write_documents_async\"):\n    result = await asyncio.to_thread(writer.run, documents=docs, policy=policy)\nelse:\n    result = await writer.run_async(documents=docs, policy=policy)","typeGuard":"def supports_async_write(store) -> TypeGuard[WriteDocumentsAsyncDocumentStore]:\n    return hasattr(store, \"write_documents_async\") and callable(store.write_documents_async)","tryCatchPattern":"try:\n    result = await writer.run_async(documents=docs)\nexcept TypeError as e:\n    if \"does not provide async support\" in str(e):\n        result = await asyncio.to_thread(writer.run, documents=docs)","preventionTips":["Use async-capable stores in async pipelines; avoid InMemoryDocumentStore there","Check hasattr(store, 'write_documents_async') when building pipelines programmatically","Keep store integration packages up to date for async API support","Pin a sync fallback in shared pipeline code"],"tags":["haystack","async","document-store","documentwriter"],"backgroundTag":"missing-async-method","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}