{"record":{"id":"0dfbaec710291ee1","repo":"microsoft/semantic-kernel","slug":"failed-to-delete-collection-self-collection-name","errorCode":null,"errorMessage":"Failed to delete collection {self.collection_name} with error: {e}","messagePattern":"Failed to delete collection (.+?) with error: (.+?)","errorType":"exception","errorClass":"VectorStoreOperationException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/chroma.py","lineNumber":190,"sourceCode":"                    space=DISTANCE_FUNCTION_MAP[vector_field.distance_function]\n                )\n            else:\n                configuration[\"hnsw\"][\"space\"] = DISTANCE_FUNCTION_MAP[vector_field.distance_function]\n            kwargs[\"configuration\"] = configuration\n        if \"get_or_create\" not in kwargs:\n            kwargs[\"get_or_create\"] = True\n\n        self.client.create_collection(name=self.collection_name, embedding_function=self.embedding_func, **kwargs)\n\n    @override\n    async def ensure_collection_deleted(self, **kwargs: Any) -> None:\n        \"\"\"Delete the collection.\"\"\"\n        try:\n            self.client.delete_collection(name=self.collection_name)\n        except ValueError:\n            logger.info(f\"Collection {self.collection_name} could not be deleted because it doesn't exist.\")\n        except Exception as e:\n            raise VectorStoreOperationException(\n                f\"Failed to delete collection {self.collection_name} with error: {e}\"\n            ) from e\n\n    def _validate_data_model(self):\n        super()._validate_data_model()\n        if len(self.definition.vector_fields) > 1:\n            raise VectorStoreModelValidationError(\n                f\"Chroma only supports one vector field, but {len(self.definition.vector_fields)} were provided.\"\n            )\n\n    @override\n    def _serialize_dicts_to_store_models(self, records: Sequence[dict[str, Any]], **kwargs: Any) -> Sequence[Any]:\n        vector_field = self.definition.vector_fields[0]\n        id_field_name = self.definition.key_name\n        store_models = []\n        for record in records:\n            store_model = {\n                \"id\": record[id_field_name],","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/chroma.py#L172-L208","documentation":"A VectorStoreOperationException raised in ensure_collection_deleted() when client.delete_collection() raises something other than ValueError. The ValueError branch (collection does not exist) is swallowed with an info log; all other exceptions (auth errors, connection errors, server-side failures) are re-raised with the original error text appended via the {e} placeholder.","triggerScenarios":"Calling await collection.ensure_collection_deleted() against a remote Chroma server that is unreachable, returns a permission error, or fails the delete for an internal reason; an expired API token or wrong tenant.","commonSituations":"Tearing down collections in CI against a shared/remote Chroma instance; deleting after the client's auth token expired; network blips during cleanup.","solutions":["Inspect the original exception text embedded in the message and __cause__ to classify the failure (connection / auth / server).","For transient network/server errors, retry ensure_collection_deleted() with backoff.","Ensure the Chroma client credentials, host, and database/tenant are correct before deletion."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if not await collection.collection_exists():\n    return  # nothing to delete","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions.vector_store_exceptions import VectorStoreOperationException\ntry:\n    await collection.ensure_collection_deleted()\nexcept VectorStoreOperationException as e:\n    if is_transient(e.__cause__):\n        await backoff_retry(lambda: collection.ensure_collection_deleted())\n    else:\n        raise","preventionTips":["Guard deletes with collection_exists() to skip when absent.","Validate client credentials/host before destructive operations.","Wrap remote deletes in retry-with-backoff for transient failures."],"tags":["chroma","vector-store","delete","network","lifecycle"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}