{"record":{"id":"4eab7f7b2e79b7cb","repo":"microsoft/semantic-kernel","slug":"record-with-key-key-does-not-exist-4eab7f","errorCode":null,"errorMessage":"Record with key '{key}' does not exist","messagePattern":"Record with key '(.+?)' does not exist","errorType":"exception","errorClass":"ServiceResourceNotFoundError","httpStatus":404,"severity":"error","filePath":"python/semantic_kernel/connectors/memory_stores/pinecone/pinecone_memory_store.py","lineNumber":244,"sourceCode":"    async def get(self, collection_name: str, key: str, with_embedding: bool = False) -> MemoryRecord:\n        \"\"\"Gets a record.\n\n        Args:\n            collection_name (str): The name of the collection to get the record from.\n            key (str): The unique database key of the record.\n            with_embedding (bool): Whether to include the embedding in the result. (default: {False})\n\n        Returns:\n            MemoryRecord: The record.\n        \"\"\"\n        if not await self.does_collection_exist(collection_name):\n            raise ServiceResourceNotFoundError(f\"Collection '{collection_name}' does not exist\")\n\n        collection = self.pinecone.Index(collection_name)\n        fetch_response = collection.fetch([key])\n\n        if len(fetch_response.vectors) == 0:\n            raise ServiceResourceNotFoundError(f\"Record with key '{key}' does not exist\")\n\n        return parse_payload(fetch_response.vectors[key], with_embedding)\n\n    async def get_batch(\n        self, collection_name: str, keys: list[str], with_embeddings: bool = False\n    ) -> list[MemoryRecord]:\n        \"\"\"Gets a batch of records.\n\n        Args:\n            collection_name (str): The name of the collection to get the records from.\n            keys (List[str]): The unique database keys of the records.\n            with_embeddings (bool): Whether to include the embeddings in the results. (default: {False})\n\n        Returns:\n            List[MemoryRecord]: The records.\n        \"\"\"\n        if not await self.does_collection_exist(collection_name):\n            raise ServiceResourceNotFoundError(f\"Collection '{collection_name}' does not exist\")","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/memory_stores/pinecone/pinecone_memory_store.py#L226-L262","documentation":"Raised in PineconeMemoryStore.get() when collection.fetch([key]) returns an empty vectors map (len(fetch_response.vectors) == 0). ServiceResourceNotFoundError indicates the specific record key is absent even though the collection exists.","triggerScenarios":"Fetching a key that was never upserted, was deleted, or is mistyped. The collection exists but the id is unknown.","commonSituations":"Reading a stale id; the record was removed by remove()/remove_batch(); id format mismatch (e.g., extra prefix/suffix).","solutions":["Verify the key was produced by a prior upsert (upsert returns record._id).","Treat absence as a non-error by catching ServiceResourceNotFoundError and returning None.","Check the key casing/format against what was stored.","Use does_collection_exist first to distinguish collection-missing from record-missing."],"exampleFix":"// before\nrec = await store.get(\"my_col\", key)\n\n// after\ntry:\n    rec = await store.get(\"my_col\", key)\nexcept ServiceResourceNotFoundError:\n    rec = None","handlingStrategy":"try-catch","validationCode":"# no pre-check for record existence; fetch is the check — keep the read cheap and handle absence\nreturn await store.get(collection_name, key)","typeGuard":"def is_valid_key(key: str) -> bool:\n    return isinstance(key, str) and len(key) > 0","tryCatchPattern":"from semantic_kernel.exceptions import ServiceResourceNotFoundError\ntry:\n    return await store.get(collection_name, key)\nexcept ServiceResourceNotFoundError:\n    return None  # treat missing record as not-found, not an error","preventionTips":["Treat record-not-found as a normal empty result, not an exception flow, where possible.","Verify keys come from prior upsert return values.","Check key formatting/casing against stored ids."],"tags":["pinecone","memory-store","deprecated","record-not-found","get"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}