FoundationAgents/MetaGPT · error · Exception

Delete collection {collection_name} failed.

Error message

Delete collection {collection_name} failed.

What it means

QdrantStore.delete_collection calls client.delete_collection(...) and treats a falsy return as failure, raising 'Delete collection {name} failed.'. The qdrant-client update_collection-style APIs return an operation result/bool; when the server reports the deletion did not succeed (or the client returns None/False), this guard fires. Note the f-string interpolates the literal '{collection_name}' only if the raise is re-raised from source; in practice the actual name is embedded.

Source

Thrown at metagpt/document_store/qdrant_store.py:76

            self.client.get_collection(collection_name)
            if force_recreate:
                res = self.client.recreate_collection(collection_name, vectors_config=vectors_config, **kwargs)
                return res
            return True
        except:  # noqa: E722
            return self.client.recreate_collection(collection_name, vectors_config=vectors_config, **kwargs)

    def has_collection(self, collection_name: str):
        try:
            self.client.get_collection(collection_name)
            return True
        except:  # noqa: E722
            return False

    def delete_collection(self, collection_name: str, timeout=60):
        res = self.client.delete_collection(collection_name, timeout=timeout)
        if not res:
            raise Exception(f"Delete collection {collection_name} failed.")

    def add(self, collection_name: str, points: List[PointStruct]):
        """
        add some vector data to qdrant
        Args:
            collection_name: collection name
            points: list of PointStruct object, about PointStruct detail in https://github.com/qdrant/qdrant-client

        Returns: NoneX

        """
        # self.client.upload_records()
        self.client.upsert(
            collection_name,
            points,
        )

    def search(

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. Check existence first: if not store.has_collection(name): skip — has_collection already wraps server errors as False.
  2. Increase the timeout: store.delete_collection(name, timeout=300) for large collections.
  3. Retry once after verifying the collection still exists, since transient server errors can return falsy results.
  4. Inspect Qdrant server logs for the underlying reason the operation was rejected.

Example fix

# before
store.delete_collection("docs")  # Exception: Delete collection docs failed.

# after
if store.has_collection("docs"):
    store.delete_collection("docs", timeout=300)
else:
    logger.info("collection 'docs' already absent")
Defensive patterns

Strategy: try-catch

Validate before calling

if store.has_collection(collection_name):
    store.delete_collection(collection_name, timeout=300)

Try / catch

try:
    store.delete_collection(name, timeout=300)
except Exception as e:
    if "failed" not in str(e).lower() or store.has_collection(name):
        raise  # real failure only if the collection still exists
    logger.warning("collection %s already gone", name)

Prevention

When it happens

Trigger: Calling delete_collection(name, timeout=...) when the collection does not exist or is already being deleted; a server-side error swallowed by the client and returned as a non-truthy result; a timeout shorter than the deletion time for large collections.

Common situations: Cleanup code running twice (second run targets an already-deleted collection); force_recreate flows in create_collection where has/deleted state races; self-hosted Qdrant under load where deletion exceeds the default 60s timeout.

Related errors


AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14). Data as JSON: /api/errors/a9f065804178e2a6. Report an issue: GitHub.