{"record":{"id":"d92d2bd600856ffb","repo":"microsoft/semantic-kernel","slug":"collection-collection-name-does-not-exist-canno-d92d2b","errorCode":null,"errorMessage":"Collection {collection_name} does not exist, cannot get.","messagePattern":"Collection (.+?) does not exist, cannot get\\.","errorType":"exception","errorClass":"ServiceResourceNotFoundError","httpStatus":404,"severity":"error","filePath":"python/semantic_kernel/connectors/memory_stores/milvus/milvus_memory_store.py","lineNumber":333,"sourceCode":"    async def get_batch(self, collection_name: str, keys: list[str], with_embeddings: bool) -> list[MemoryRecord]:\n        \"\"\"Get the MemoryRecords corresponding to the keys.\n\n        Args:\n            collection_name (str): _description_\n            keys (List[str]): _description_\n            with_embeddings (bool): _description_\n\n        Raises:\n            Exception: _description_\n            e: _description_\n\n        Returns:\n            List[MemoryRecord]: _description_\n        \"\"\"\n        # Check if the collection exists\n        if not utility.has_collection(collection_name):\n            logger.debug(f\"Collection {collection_name} does not exist, cannot get.\")\n            raise ServiceResourceNotFoundError(f\"Collection {collection_name} does not exist, cannot get.\")\n\n        try:\n            self.collections[collection_name].load()\n            gets = self.collections[collection_name].query(\n                expr=f\"{SEARCH_FIELD_ID} in {keys}\",\n                output_fields=OUTPUT_FIELDS_W_EMBEDDING if with_embeddings else OUTPUT_FIELDS_WO_EMBEDDING,\n            )\n        except Exception as e:\n            logger.debug(f\"Get failed due to: {e}\")\n            raise ServiceResponseException(f\"Get failed due to: {e}\") from e\n        return [milvus_dict_to_memoryrecord(get) for get in gets]\n\n    async def remove(self, collection_name: str, key: str) -> None:\n        \"\"\"Remove the specified record based on key.\n\n        Args:\n            collection_name (str): Collection to remove from.\n            key (str): The key to remove.","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/memory_stores/milvus/milvus_memory_store.py#L315-L351","documentation":"Raised as a ServiceResourceNotFoundError in MilvusMemoryStore.get_batch when utility.has_collection(collection_name) returns False. This guards the query path: without the collection, no records can be retrieved.","triggerScenarios":"Calling await store.get('my_collection', key) or get_batch before the collection exists. Note get delegates to get_batch internally. Also triggered when the collection was dropped between creation and the read.","commonSituations":"Querying a collection name that was never created or was deleted. Connecting to a fresh Milvus instance. Collection name casing or whitespace mismatch.","solutions":["Ensure create_collection ran successfully before any get/get_batch call.","Guard with utility.has_collection(collection_name) or store.does_collection_exist.","Catch ServiceResourceNotFoundError and return None or an empty result for non-fatal missing collections.","Verify the Milvus connection targets the right database/namespace."],"exampleFix":"// before\nrecord = await store.get('docs', key)  # ServiceResourceNotFoundError\n// after\nif not utility.has_collection('docs'):\n    record = None\nelse:\n    record = await store.get('docs', key)","handlingStrategy":"validation","validationCode":"from pymilvus import utility\n\nif not utility.has_collection('docs'):\n    record = None\nelse:\n    record = await store.get('docs', key)","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import ServiceResourceNotFoundError\n\ntry:\n    record = await store.get('docs', key)\nexcept ServiceResourceNotFoundError:\n    record = None","preventionTips":["Guard get/get_batch with utility.has_collection.","Ensure create_collection ran before reads.","Verify the target Milvus database/namespace.","Return None or empty list for missing collections when non-fatal."],"tags":["milvus","collection","resource-not-found","get","python"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}