microsoft/semantic-kernel · warning · VectorStoreOperationException
No vector or keywords provided for vector search.
Error message
No vector or keywords provided for vector search.
What it means
Raised by _inner_search for SearchType.VECTOR when both the 'vector' argument and the 'values' argument are None. A pure vector search requires either a precomputed vector (Sequence[float|int]) or text 'values' that can be embedded/vectorized. With neither, there is no query to run, so a VectorStoreOperationException is thrown before contacting the service.
Source
Thrown at python/semantic_kernel/connectors/azure_ai_search.py:593
elif values is not None:
generated_vector = await self._generate_vector_from_values(values or "*", options)
vector_field = self.definition.try_get_vector_field(options.vector_property_name)
if generated_vector is not None:
search_args["vector_queries"] = [
VectorizedQuery(
vector=generated_vector, # type: ignore
fields=vector_field.storage_name or vector_field.name if vector_field else None,
)
]
else:
search_args["vector_queries"] = [
VectorizableTextQuery(
text=values,
fields=vector_field.storage_name or vector_field.name if vector_field else None,
)
]
else:
raise VectorStoreOperationException("No vector or keywords provided for vector search.")
case SearchType.KEYWORD_HYBRID:
if values is None:
raise VectorStoreOperationException("No vector and/or keywords provided for search.")
vector_field = self.definition.try_get_vector_field(options.vector_property_name)
search_args["search_fields"] = (
[options.additional_property_name]
if options.additional_property_name is not None
else [
field.name
for field in self.definition.fields
if field.field_type == FieldTypes.DATA and field.is_full_text_indexed
]
)
if not search_args["search_fields"]:
raise VectorStoreOperationException("No searchable fields found for hybrid search.")
search_args["search_text"] = values
vector = await self._generate_vector_from_values(values, options) if vector is None else vectorView on GitHub (pinned to c028a0c7dc)
Solutions
- Always provide either a precomputed vector or a non-None values (text) for vector search.
- If using text values, ensure an embedding_generator is configured on the collection so values can be vectorized.
- Guard the call: skip or error early upstream if both vector and values resolve to None.
Example fix
// before
results = await collection.search(vector=None, values=query_text) # query_text is None
// after
if query_text:
results = await collection.search(values=query_text)
else:
raise ValueError("query text required for vector search") Defensive patterns
Strategy: validation
Validate before calling
def require_vector_search_input(vector=None, values=None):
if vector is None and values is None:
raise ValueError("VECTOR search requires a vector or values")
require_vector_search_input(vector=vec, values=q) Try / catch
from semantic_kernel.exceptions import VectorStoreOperationException
try:
res = await collection.search(vector=vec, values=q)
except VectorStoreOperationException as e:
if "No vector or keywords provided" in str(e):
q = q or default_query
res = await collection.search(values=q)
raise Prevention
- Always pass non-None values (text) or a precomputed vector for vector search.
- Ensure an embedding_generator is configured if relying on text-to-vector.
- Guard call sites where query input may be conditionally None.
When it happens
Trigger: Calling search with search_type=SearchType.VECTOR (the collection's default for vector-only) while passing neither vector nor values — e.g. search(vector=None, values=None). Also when a caller's embedding pipeline returned None and that None was forwarded as values.
Common situations: Conditionally building a query that ends up with no input; an upstream embedding service returning None on failure and that propagating into the search call; defaulting values to None when the user submitted an empty string.
Related errors
- No keys or options provided for get operation.
- Invalid index type supplied, should be a SearchIndex object.
- 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/479f05ea33f8b249.
Report an issue: GitHub.