{"record":{"id":"d1580e7937f42d32","repo":"microsoft/semantic-kernel","slug":"index-with-field-index-kind-is-not-supported","errorCode":null,"errorMessage":"Index with {field.index_kind} is not supported.","messagePattern":"Index with (.+?) is not supported\\.","errorType":"exception","errorClass":"VectorStoreInitializationException","httpStatus":null,"severity":"warning","filePath":"python/semantic_kernel/connectors/faiss.py","lineNumber":64,"sourceCode":"    \"\"\"Create a Faiss index.\"\"\"\n    if field.index_kind not in INDEX_KIND_MAP:\n        raise VectorStoreInitializationException(f\"Index kind {field.index_kind} is not supported.\")\n    if field.distance_function not in DISTANCE_FUNCTION_MAP:\n        raise VectorStoreInitializationException(f\"Distance function {field.distance_function} is not supported.\")\n    match field.index_kind:\n        case IndexKind.FLAT | IndexKind.DEFAULT:\n            match field.distance_function:\n                case DistanceFunction.EUCLIDEAN_SQUARED_DISTANCE | DistanceFunction.DEFAULT:\n                    return faiss.IndexFlatL2(field.dimensions)\n                case DistanceFunction.DOT_PROD:\n                    return faiss.IndexFlatIP(field.dimensions)\n                case _:\n                    raise VectorStoreInitializationException(\n                        f\"Distance function {field.distance_function} is \"\n                        f\"not supported for index kind {field.index_kind}.\"\n                    )\n        case _:\n            raise VectorStoreInitializationException(f\"Index with {field.index_kind} is not supported.\")\n\n\nclass FaissCollection(InMemoryCollection[TKey, TModel], Generic[TKey, TModel]):\n    \"\"\"Create a Faiss collection.\n\n    The Faiss Collection builds on the InMemoryVectorCollection,\n    it maintains indexes and mappings for each vector field.\n    \"\"\"\n\n    indexes: MutableMapping[str, faiss.Index] = Field(default_factory=dict)\n    indexes_key_map: MutableMapping[str, MutableMapping[TKey, int]] = Field(default_factory=dict)\n\n    def __init__(\n        self,\n        record_type: type[TModel],\n        definition: VectorStoreCollectionDefinition | None = None,\n        collection_name: str | None = None,\n        embedding_generator: EmbeddingGeneratorBase | None = None,","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/faiss.py#L46-L82","documentation":"A VectorStoreInitializationException raised by the final 'case _' of _create_index() (faiss.py:64) when index_kind passes the outer INDEX_KIND_MAP check but the match on index_kind has no corresponding case. Like error 1294, this is a secondary guard: the outer map (FLAT, DEFAULT) and the match arm (FLAT | DEFAULT) cover the same values, so this fires only if the two diverge after an edit.","triggerScenarios":"Effectively unreachable with current maps — would require INDEX_KIND_MAP to contain a kind that the match statement does not handle.","commonSituations":"Not encountered in normal usage; defensive guard against future map/match drift.","solutions":["Check for a library bug (INDEX_KIND_MAP vs match arms inconsistency) and file an issue.","Workaround: pass a pre-built faiss.Index via 'index'/'indexes' to skip _create_index."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from semantic_kernel.connectors.faiss import INDEX_KIND_MAP\nSUPPORTED_MATCH = {IndexKind.FLAT, IndexKind.DEFAULT}\nassert set(INDEX_KIND_MAP) == SUPPORTED_MATCH, \"Faiss index-kind maps are inconsistent; report a library bug\"","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import VectorStoreInitializationException\ntry:\n    FaissCollection(record_type=Doc)\nexcept VectorStoreInitializationException as e:\n    if \"Index with\" in str(e) and \"is not supported\" in str(e):\n        # pass a pre-built faiss.Index; report library bug if maps should align\n        ...","preventionTips":["Use IndexKind.FLAT for auto-created Faiss indexes.","Supply explicit faiss.Index objects for non-flat indexes."],"tags":["faiss","vector-store","configuration","index-kind","defensive"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}