{"record":{"id":"fddd35686304bf3d","repo":"microsoft/semantic-kernel","slug":"no-keys-or-options-provided-for-get-operation","errorCode":null,"errorMessage":"No keys or options provided for get operation.","messagePattern":"No keys or options provided for get operation\\.","errorType":"exception","errorClass":"VectorStoreOperationException","httpStatus":null,"severity":"warning","filePath":"python/semantic_kernel/connectors/azure_ai_search.py","lineNumber":493,"sourceCode":"            return [res for res in gather_result if not isinstance(res, BaseException)]\n        if options is not None:\n            ordering = []\n            if options.order_by:\n                for field, asc_flag in options.order_by.items():\n                    if field not in self.definition.storage_names:\n                        logger.warning(f\"Field {field} not in data model, skipping.\")\n                        continue\n                    ordering.append(field if asc_flag else f\"{field} desc\")\n\n            result = await client.search(\n                search_text=\"*\",\n                top=options.top,\n                skip=options.skip,\n                select=selected_fields,\n                order_by=ordering,\n            )\n            return [res async for res in result]\n        raise VectorStoreOperationException(\"No keys or options provided for get operation.\")\n\n    @override\n    async def _inner_delete(self, keys: Sequence[TKey], **kwargs: Any) -> None:\n        await self.search_client.delete_documents(documents=[{self._key_field_name: key} for key in keys])\n\n    @override\n    def _serialize_dicts_to_store_models(self, records: Sequence[dict[str, Any]], **kwargs: Any) -> Sequence[Any]:\n        return records\n\n    @override\n    def _deserialize_store_models_to_dicts(self, records: Sequence[Any], **kwargs: Any) -> Sequence[dict[str, Any]]:\n        return records\n\n    @override\n    async def ensure_collection_exists(self, **kwargs) -> None:\n        \"\"\"Create a new collection in Azure AI Search.\n\n        Args:","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/azure_ai_search.py#L475-L511","documentation":"Raised by _inner_get when both the keys argument and the options argument are None. The get operation needs either a set of document keys to fetch directly or a GetFilteredRecordOptions to perform a filtered search; with neither, there is nothing to retrieve, so a VectorStoreOperationException is thrown. This is an API-misuse error, not a data/network error.","triggerScenarios":"Calling collection.get(keys=None, options=None), or invoking the higher-level .get()/inner get path without supplying keys or a filter options object. Typically a caller bug where the arguments were computed conditionally and ended up both None.","commonSituations":"Branching logic that sometimes yields no keys and no options but still calls get; a wrapper that forwards optional parameters without defaulting one; calling get expecting it to 'list all' — use search for that instead.","solutions":["Always pass either keys (a sequence of document key strings) or options (a GetFilteredRecordOptions) to get.","If you intend to browse records without specific keys, use collection.search() or _inner_search with a VectorSearchOptions instead of get.","Guard the call site: only invoke get when at least one of keys/options is non-None."],"exampleFix":"// before\nrecs = await collection.get(keys=maybe_keys)  # maybe_keys is None\n\n// after\nif maybe_keys:\n    recs = await collection.get(keys=maybe_keys)\nelse:\n    recs = await collection.get(options=GetFilteredRecordOptions(top=50))","handlingStrategy":"validation","validationCode":"def ensure_get_args(keys=None, options=None):\n    if keys is None and options is None:\n        raise ValueError(\"Provide either keys or options to get()\")\n\nensure_get_args(keys=maybe_keys, options=opts)","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import VectorStoreOperationException\ntry:\n    recs = await collection.get(keys=keys, options=options)\nexcept VectorStoreOperationException as e:\n    if \"No keys or options provided\" in str(e):\n        options = GetFilteredRecordOptions(top=50)  # fallback to listing\n        recs = await collection.get(options=options)\n    raise","preventionTips":["Never call get() without asserting at least one of keys/options is non-None.","Use search() rather than get() to browse without specific keys.","Wrap caller logic so optional params default to a sensible options object."],"tags":["api-misuse","azure-ai-search","get-operation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}