microsoft/semantic-kernel · error · VectorStoreModelException
Vector field '{options.vector_property_name}' not found in t
Error message
Vector field '{options.vector_property_name}' not found in the data model definition. What it means
Thrown by _inner_search (in_memory.py:672-674) as VectorStoreModelException when options.vector_property_name does not match any vector field in the data model definition (definition.try_get_vector_field returns None). This happens before any distance computation, during search setup.
Source
Thrown at python/semantic_kernel/connectors/in_memory.py:673
async def collection_exists(self, **kwargs: Any) -> bool:
return True
@override
async def _inner_search(
self,
search_type: SearchType,
options: VectorSearchOptions,
values: Any | None = None,
vector: Sequence[float | int] | None = None,
**kwargs: Any,
) -> KernelSearchResults[VectorSearchResult[TModel]]:
"""Inner search method."""
if not vector:
vector = await self._generate_vector_from_values(values, options)
return_records: dict[TKey, float] = {}
field = self.definition.try_get_vector_field(options.vector_property_name)
if not field:
raise VectorStoreModelException(
f"Vector field '{options.vector_property_name}' not found in the data model definition."
)
if field.distance_function not in DISTANCE_FUNCTION_MAP:
raise VectorSearchExecutionException(
f"Distance function '{field.distance_function}' is not supported. "
f"Supported functions are: {list(DISTANCE_FUNCTION_MAP.keys())}"
)
distance_func = DISTANCE_FUNCTION_MAP[field.distance_function] # type: ignore[assignment]
for key, record in self._get_filtered_records(options).items():
if vector and field is not None:
return_records[key] = self._calculate_vector_similarity(
vector,
record[field.storage_name or field.name],
distance_func,
invert_score=field.distance_function == DistanceFunction.COSINE_SIMILARITY,
)
if field.distance_function == DistanceFunction.DEFAULT:View on GitHub (pinned to c028a0c7dc)
Solutions
- Set vector_property_name to the exact name of a declared vector field in the model definition.
- Ensure the model actually declares at least one vector field with a matching name.
- If the model has multiple vector fields, always specify vector_property_name explicitly.
Example fix
# before opts = VectorSearchOptions(vector_property_name='embeding') # typo / not declared results = await collection.search(search_type=SearchType.VECTOR, options=opts, values='q') # after opts = VectorSearchOptions(vector_property_name='embedding') # matches declared field
Defensive patterns
Strategy: validation
Validate before calling
def resolve_vector_field(definition, name: str | None):
field = definition.try_get_vector_field(name)
if field is None:
raise ValueError(
f"no vector field named {name!r}; available: {definition.vector_field_names()}"
)
return field Type guard
def has_vector_field(definition, name: str | None) -> bool:
return definition.try_get_vector_field(name) is not None Try / catch
from semantic_kernel.exceptions.vector_store_exceptions import VectorStoreModelException
try:
results = await collection.search(search_type=SearchType.VECTOR, options=opts, values='q')
except VectorStoreModelException as e:
# fix vector_property_name and retry
... Prevention
- Keep search vector_property_name in sync with the declared vector field name.
- After renaming a vector field, update all search call sites.
- For multi-vector models, always set vector_property_name explicitly.
When it happens
Trigger: Calling vector search with VectorSearchOptions(vector_property_name='foo') where 'foo' is not a declared vector field; omitting vector_property_name when the model has zero or multiple vector fields; a name/storage_name mismatch.
Common situations: Renaming a vector field without updating search options; mis-typing the property name; model with multiple vector fields where the default resolution is ambiguous.
Related errors
- Field name '{IN_MEMORY_SCORE_KEY}' is reserved for internal
- Distance function '{field.distance_function}' is not support
- Filter string must be a lambda expression, e.g. 'lambda x: x
- AST node type '{node_type.__name__}' is not allowed in filte
- Last message in chat history was null or whitespace.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/6dd0f8a54235e7ed.
Report an issue: GitHub.