{"record":{"id":"eef1042490ac095f","repo":"microsoft/semantic-kernel","slug":"vector-property-type-field-type-is-not-suppor","errorCode":null,"errorMessage":"Vector property type '{field.type_}' is not supported by Azure Cosmos DB NoSQL.","messagePattern":"Vector property type '(.+?)' is not supported by Azure Cosmos DB NoSQL\\.","errorType":"exception","errorClass":"VectorStoreModelException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/azure_cosmos_db.py","lineNumber":182,"sourceCode":"        definition (VectorStoreRecordDefinition): The definition of the data model.\n\n    Returns:\n        dict[str, Any]: The vector embedding policy.\n\n    Raises:\n        VectorStoreModelException: If the datatype or distance function is not supported by Azure Cosmos DB NoSQL.\n\n    \"\"\"\n    vector_embedding_policy: dict[str, Any] = {\"vectorEmbeddings\": []}\n\n    for field in definition.fields:\n        if field.field_type == FieldTypes.VECTOR:\n            if field.distance_function not in DISTANCE_FUNCTION_MAP_NOSQL:\n                raise VectorStoreModelException(\n                    f\"Distance function '{field.distance_function}' is not supported by Azure Cosmos DB NoSQL.\"\n                )\n            if field.type_ and field.type_ not in VECTOR_DATATYPES_MAP:\n                raise VectorStoreModelException(\n                    f\"Vector property type '{field.type_}' is not supported by Azure Cosmos DB NoSQL.\"\n                )\n\n            vector_embedding_policy[\"vectorEmbeddings\"].append({\n                \"path\": f'/\"{field.storage_name or field.name}\"',\n                \"dataType\": VECTOR_DATATYPES_MAP[field.type_ or \"default\"],\n                \"distanceFunction\": DISTANCE_FUNCTION_MAP_NOSQL[field.distance_function],\n                \"dimensions\": field.dimensions,\n            })\n\n    return vector_embedding_policy\n\n\ndef _get_key(key: str | CosmosNoSqlCompositeKey) -> str:\n    \"\"\"Gets the key value from the key.\"\"\"\n    if isinstance(key, CosmosNoSqlCompositeKey):\n        return key.key\n    return key","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/azure_cosmos_db.py#L164-L200","documentation":"The NoSQL vector embedding policy builder rejects vector fields whose Python type annotation (field.type_) is not in the allowed type map. Allowed types map to float32 or int32 Cosmos datatypes. The check is skipped when type_ is falsy, but any non-empty unsupported string value triggers the exception.","triggerScenarios":"Raised in _get_vector_embedding_policy when field.field_type == VECTOR, field.type_ is truthy, and field.type_ not in VECTOR_DATATYPES_MAP. Happens on collection creation/policy build for a vector field annotated with an unsupported type such as 'list[str]', 'numpy.ndarray', 'float16', or a custom class name.","commonSituations":"Annotating the vector field with a non-standard type (e.g. a numpy type, a TypedDict, a bare 'list' without parameterization). Copying a model from a connector that accepts a broader type vocabulary. Forgetting that Cosmos NoSQL only stores float32 and int32 vectors.","solutions":["Annotate the vector field as list[float], list[int], float, or int so it maps to float32/int32.","Remove an explicit unsupported type_ override and let it default to float32.","If you need a different precision, store as float32/int32 and cast on the application side."],"exampleFix":"// before\nVectorStoreRecordVectorField(name=\"embedding\", dimensions=1536, type=\"numpy.ndarray\")\n// after\nVectorStoreRecordVectorField(name=\"embedding\", dimensions=1536, type=\"list[float]\")","handlingStrategy":"validation","validationCode":"from semantic_kernel.connectors.azure_cosmos_db import VECTOR_DATATYPES_MAP\n\nbad = [f for f in definition.vector_fields if f.type_ and f.type_ not in VECTOR_DATATYPES_MAP]\nif bad:\n    raise ValueError(f\"Unsupported vector types: {[(f.name, f.type_) for f in bad]}\")\n","typeGuard":"def is_supported_vector_type(type_: str | None) -> bool:\n    return not type_ or type_ in VECTOR_DATATYPES_MAP\n","tryCatchPattern":null,"preventionTips":["Annotate vector fields with list[float] or list[int] only.","Avoid numpy/custom types on the model; cast at the application boundary.","Add a lint check that flags non-standard vector type_ values."],"tags":["azure-cosmos-db","vector-store","data-model","typing"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}