microsoft/semantic-kernel · warning · VectorStoreOperationException
No keys or options provided for get operation.
Error message
No keys or options provided for get operation.
What it means
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.
Source
Thrown at python/semantic_kernel/connectors/azure_ai_search.py:493
return [res for res in gather_result if not isinstance(res, BaseException)]
if options is not None:
ordering = []
if options.order_by:
for field, asc_flag in options.order_by.items():
if field not in self.definition.storage_names:
logger.warning(f"Field {field} not in data model, skipping.")
continue
ordering.append(field if asc_flag else f"{field} desc")
result = await client.search(
search_text="*",
top=options.top,
skip=options.skip,
select=selected_fields,
order_by=ordering,
)
return [res async for res in result]
raise VectorStoreOperationException("No keys or options provided for get operation.")
@override
async def _inner_delete(self, keys: Sequence[TKey], **kwargs: Any) -> None:
await self.search_client.delete_documents(documents=[{self._key_field_name: key} for key in keys])
@override
def _serialize_dicts_to_store_models(self, records: Sequence[dict[str, Any]], **kwargs: Any) -> Sequence[Any]:
return records
@override
def _deserialize_store_models_to_dicts(self, records: Sequence[Any], **kwargs: Any) -> Sequence[dict[str, Any]]:
return records
@override
async def ensure_collection_exists(self, **kwargs) -> None:
"""Create a new collection in Azure AI Search.
Args:View on GitHub (pinned to c028a0c7dc)
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.
Example fix
// before
recs = await collection.get(keys=maybe_keys) # maybe_keys is None
// after
if maybe_keys:
recs = await collection.get(keys=maybe_keys)
else:
recs = await collection.get(options=GetFilteredRecordOptions(top=50)) Defensive patterns
Strategy: validation
Validate before calling
def ensure_get_args(keys=None, options=None):
if keys is None and options is None:
raise ValueError("Provide either keys or options to get()")
ensure_get_args(keys=maybe_keys, options=opts) Try / catch
from semantic_kernel.exceptions import VectorStoreOperationException
try:
recs = await collection.get(keys=keys, options=options)
except VectorStoreOperationException as e:
if "No keys or options provided" in str(e):
options = GetFilteredRecordOptions(top=50) # fallback to listing
recs = await collection.get(options=options)
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid index type supplied, should be a SearchIndex object.
- No vector or keywords provided for vector search.
- No vector and/or keywords provided for search.
- Azure AI Search tool definition must have both 'index_connec
- City '{city}' is not in the list of cities: {', '.join(citie
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/fddd35686304bf3d.
Report an issue: GitHub.