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

During _inner_search the connector resolves the vector field to search against via definition.try_get_vector_field(options.vector_property_name). If no VectorStoreField in the data model definition matches that name, it returns None and the connector raises VectorStoreModelException. The message names the offending vector_property_name so you can see exactly which string failed to resolve.

Source

Thrown at python/semantic_kernel/connectors/faiss.py:220

    @override
    async def collection_exists(self, **kwargs: Any) -> bool:
        return bool(self.indexes)

    @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)
        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."
            )
        return_list = []
        # first we create the vector to search with
        np_vector = np.array(vector, dtype=np.float32).reshape(1, -1)
        # then do the actual vector search
        distances, indexes = self.indexes[field.name].search(
            np_vector, min(options.top, self.indexes[field.name].ntotal)
        )  # type: ignore[call-arg]
        # since Faiss indexes do not contain the full records,
        # we get the filtered records, this is a dict of the records that match the search filters
        # and use that to get the actual records
        filtered_records = self._get_filtered_records(options)
        # we then iterate through the results, the order is the order of relevance
        # (less or most distance, dependant on distance metric used)
        for i, index in enumerate(indexes[0]):
            key = list(self.indexes_key_map[field.name].keys())[index]
            # if the key is not in the filtered records, we ignore it

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Set options.vector_property_name to the exact .name of a VectorStoreField declared in the definition.
  2. If the collection has exactly one vector field, omit vector_property_name so the default resolution picks it.
  3. Inspect [f.name for f in collection.definition.vector_fields] to list the valid vector field names before searching.

Example fix

# before
res = await collection.search(vector=[...], options=VectorSearchOptions(vector_property_name='embedding', top=5))
# 'embedding' is not a declared vector field -> [1301]

# after
valid = [f.name for f in collection.definition.vector_fields]
res = await collection.search(vector=[...], options=VectorSearchOptions(vector_property_name='text_vector', top=5))
Defensive patterns

Strategy: validation

Validate before calling

def resolve_vector_field(collection, name):
    names = {f.name for f in collection.definition.vector_fields}
    if name is None and len(names) == 1:
        return next(iter(names))
    if name not in names:
        raise ValueError(f"vector_property_name must be one of {sorted(names)}, got {name!r}")
    return name

Type guard

def is_known_vector_field(collection, name: str | None) -> bool:
    names = {f.name for f in collection.definition.vector_fields}
    return name is None or name in names

Try / catch

from semantic_kernel.exceptions.vector_store_exceptions import VectorStoreModelException
try:
    await collection.search(vector=[...], options=opts)
except VectorStoreModelException as ex:
    if 'not found in the data model' in str(ex):
        opts.vector_property_name = next(iter({f.name for f in collection.definition.vector_fields}))
        await collection.search(vector=[...], options=opts)
    else:
        raise

Prevention

When it happens

Trigger: Calling collection.search / _inner_search with VectorSearchOptions(vector_property_name='foo') where 'foo' is not the .name of any VectorStoreField in the collection definition. Also fires when the default vector_property_name does not match the only/multiple vector fields, or when you used the field's storage_name instead of its name.

Common situations: Typo in the field name; the field was renamed in the data model but not in search calls; multiple vector fields and the wrong one selected; confusing storage_name with name; switching record types on a shared collection.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/685a8baea54c18af. Report an issue: GitHub.