microsoft/semantic-kernel · error · VectorStoreInitializationException

Index kind {vector_field.index_kind} is not supported.

Error message

Index kind {vector_field.index_kind} is not supported.

What it means

A VectorStoreInitializationException thrown by ChromaCollection during collection creation when the first vector field's index_kind is not in INDEX_KIND_MAP. The map (chroma.py:56-59) only permits IndexKind.HNSW and IndexKind.DEFAULT. Chroma uses HNSW exclusively, so any other index kind (FLAT, etc.) is rejected up front.

Source

Thrown at python/semantic_kernel/connectors/chroma.py:165

        ```python
        await collection.create_collection(
            configuration={"hnsw": {"max_neighbors": 16, "ef_construction": 200, "ef_search": 200}}
        )
        ```
        if the `space` is set, it will be overridden, by the distance function set in the data model.

        To use the built-in Chroma embedding functions, set the `embedding_func` parameter in the class constructor.

        Args:
            kwargs: Additional arguments are passed to the metadata parameter of the create_collection method.
                See the Chroma documentation for more details.
        """
        if self.definition.vector_fields:
            configuration = kwargs.pop("configuration", {})
            configuration = CreateCollectionConfiguration(**configuration)
            vector_field = self.definition.vector_fields[0]
            if vector_field.index_kind not in INDEX_KIND_MAP:
                raise VectorStoreInitializationException(f"Index kind {vector_field.index_kind} is not supported.")
            if vector_field.distance_function not in DISTANCE_FUNCTION_MAP:
                raise VectorStoreInitializationException(
                    f"Distance function {vector_field.distance_function} is not supported."
                )
            if "hnsw" not in configuration or configuration["hnsw"] is None:
                configuration["hnsw"] = CreateHNSWConfiguration(
                    space=DISTANCE_FUNCTION_MAP[vector_field.distance_function]
                )
            else:
                configuration["hnsw"]["space"] = DISTANCE_FUNCTION_MAP[vector_field.distance_function]
            kwargs["configuration"] = configuration
        if "get_or_create" not in kwargs:
            kwargs["get_or_create"] = True

        self.client.create_collection(name=self.collection_name, embedding_function=self.embedding_func, **kwargs)

    @override
    async def ensure_collection_deleted(self, **kwargs: Any) -> None:

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Set the vector field's index_kind to IndexKind.HNSW (or IndexKind.DEFAULT, which maps to HNSW) in the VectorStoreRecordVectorField definition.
  2. If you intentionally need a flat/brute-force index, use the Faiss or in-memory connector instead of Chroma.

Example fix

// before
VectorStoreRecordVectorField(name="embedding", index_kind=IndexKind.FLAT, dimensions=1536)
// after
VectorStoreRecordVectorField(name="embedding", index_kind=IndexKind.HNSW, dimensions=1536)
Defensive patterns

Strategy: validation

Validate before calling

from semantic_kernel.connectors.chroma import INDEX_KIND_MAP
assert all(f.index_kind in INDEX_KIND_MAP for f in definition.vector_fields), (
    f"Chroma only supports index kinds: {[k.value for k in INDEX_KIND_MAP]}"
)

Type guard

from semantic_kernel.data.vector import IndexKind
from semantic_kernel.connectors.chroma import INDEX_KIND_MAP

def is_chroma_index_kind(kind: IndexKind) -> bool:
    return kind in INDEX_KIND_MAP

Try / catch

from semantic_kernel.exceptions.vector_store_exceptions import VectorStoreInitializationException
try:
    await collection.ensure_collection_exists()
except VectorStoreInitializationException as e:
    if "Index kind" in str(e):
        # fix the field definition's index_kind
        ...

Prevention

When it happens

Trigger: Defining a VectorStoreRecordVectorField with index_kind=IndexKind.FLAT (or any non-HNSW kind) and passing that collection definition to a ChromaCollection; reusing a data model built for the Faiss or in-memory connector with Chroma.

Common situations: Porting a vector record model from the in-memory/Faiss connector (which use FLAT) to Chroma without updating index_kind; copy-pasting a field definition that omits index_kind assuming a default that maps to HNSW.

Related errors


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