{"record":{"id":"4ff2272a68bd2db2","repo":"microsoft/semantic-kernel","slug":"error-upserting-record-upsert-response-message","errorCode":null,"errorMessage":"Error upserting record: {upsert_response.message}","messagePattern":"Error upserting record: (.+?)","errorType":"exception","errorClass":"ServiceResponseException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/memory_stores/pinecone/pinecone_memory_store.py","lineNumber":192,"sourceCode":"        Args:\n            collection_name (str): The name of the collection to upsert the record into.\n            record (MemoryRecord): The record to upsert.\n\n        Returns:\n            str: The unique database key of the record. In Pinecone, this is the record ID.\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\n        upsert_response = collection.upsert(\n            vectors=[(record._id, record.embedding.tolist(), build_payload(record))],\n            namespace=\"\",\n        )\n\n        if upsert_response.upserted_count is None:\n            raise ServiceResponseException(f\"Error upserting record: {upsert_response.message}\")\n\n        return record._id\n\n    async def upsert_batch(self, collection_name: str, records: list[MemoryRecord]) -> list[str]:\n        \"\"\"Upsert a batch of records.\n\n        Args:\n            collection_name (str): The name of the collection to upsert the records into.\n            records (List[MemoryRecord]): The records to upsert.\n\n        Returns:\n            List[str]: The unique database keys of the records.\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","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/memory_stores/pinecone/pinecone_memory_store.py#L174-L210","documentation":"Raised in PineconeMemoryStore.upsert() when collection.upsert(...) returns a response whose upserted_count is None. ServiceResponseException wraps the server message from upsert_response.message. The collection exists and the call reached Pinecone, but Pinecone reported no confirmed upsert count.","triggerScenarios":"Pinecone returned a non-success response with a populated message (e.g., vector dimension mismatch with the index, malformed vector, rate limit, or a transient server error). The empty-count heuristic treats any None count as failure.","commonSituations":"Embedding dimension in the record differs from the index dimension; embedding field is None/empty; payload exceeds Pinecone metadata size limits; transient Pinecone-side error.","solutions":["Inspect upsert_response.message in the exception to get the exact Pinecone reason.","Verify record.embedding dimension equals the index's configured dimension.","Ensure record.embedding is a non-empty ndarray and record._id is a valid Pinecone id.","Retry on transient server messages; reduce metadata size if metadata limits are hit."],"exampleFix":"// before\nawait store.upsert(\"my_col\", record)\n\n// after\n# ensure embedding dim matches index dim, then retry on transient errors\ntry:\n    await store.upsert(\"my_col\", record)\nexcept ServiceResponseException as e:\n    log.error(\"pinecone upsert failed: %s\", e)\n    raise","handlingStrategy":"try-catch","validationCode":"assert record.embedding is not None and record.embedding.shape[0] == expected_dim\nassert record._id and isinstance(record._id, str)\nawait store.upsert(collection_name, record)","typeGuard":"def is_valid_record_for_index(record: MemoryRecord, dim: int) -> bool:\n    return record.embedding is not None and record.embedding.shape[0] == dim","tryCatchPattern":"from semantic_kernel.exceptions import ServiceResponseException\ntry:\n    await store.upsert(collection_name, record)\nexcept ServiceResponseException as e:\n    # e message carries upsert_response.message from Pinecone\n    logger.error(\"upsert rejected by Pinecone: %s\", e)\n    raise","preventionTips":["Match record.embedding dimension to the index dimension.","Inspect the server message in the exception for the real cause.","Retry transient server errors with backoff."],"tags":["pinecone","memory-store","deprecated","upsert","dimension-mismatch","server-error"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}