{"record":{"id":"77cdf51e06ef2c91","repo":"microsoft/semantic-kernel","slug":"api-type-cosmos-api-is-not-supported","errorCode":null,"errorMessage":"API type {cosmos_api} is not supported.","messagePattern":"API type (.+?) is not supported\\.","errorType":"validation","errorClass":"MemoryConnectorInitializationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/memory_stores/azure_cosmosdb/azure_cosmos_db_memory_store.py","lineNumber":125,"sourceCode":"            mongodb_client = MongoClient(\n                cosmosdb_settings.connection_string.get_secret_value() if cosmosdb_settings.connection_string else None,\n                appname=application_name,\n            )\n            database = mongodb_client[database_name]\n            api_store = MongoStoreApi(\n                collection_name=collection_name,\n                index_name=index_name,\n                vector_dimensions=vector_dimensions,\n                num_lists=num_lists,\n                similarity=similarity,\n                database=database,\n                kind=kind,\n                m=m,\n                ef_construction=ef_construction,\n                ef_search=ef_search,\n            )\n        else:\n            raise MemoryConnectorInitializationError(f\"API type {cosmos_api} is not supported.\")\n\n        store = AzureCosmosDBMemoryStore(\n            api_store,\n            database_name,\n            index_name,\n            vector_dimensions,\n            num_lists,\n            similarity,\n            kind,\n            m,\n            ef_construction,\n            ef_search,\n        )\n        await store.create_collection(collection_name)\n        return store\n\n    async def create_collection(self, collection_name: str) -> None:\n        \"\"\"Creates a new collection in the data store.","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/memory_stores/azure_cosmosdb/azure_cosmos_db_memory_store.py#L107-L143","documentation":"Raised in the static `AzureCosmosDBMemoryStore.create` factory when the `cosmos_api` argument is anything other than `\"mongo-vcore\"`. The factory is written to support multiple API types but currently only implements the MongoDB vCore path; any other value falls into the `else` and raises `MemoryConnectorInitializationError`.","triggerScenarios":"Calling `AzureCosmosDBMemoryStore.create(..., cosmos_api=\"...\")` with a value other than `\"mongo-vcore\"` (e.g. `\"nosql\"`, `\"cassandra\"`, `\"table\"`, or a typo).","commonSituations":"Trying to use the Cosmos DB NoSQL API or another Cosmos API with this (legacy) memory store; upgrading/downgrading SK versions expecting broader API support; typo in the literal; following outdated docs that reference an unsupported API type.","solutions":["Use `cosmos_api=\"mongo-vcore\"` (the only currently supported value) with an Azure Cosmos DB for MongoDB (vCore) account.","If you need the Cosmos DB NoSQL API, use the newer vector-store connector (`CosmosNoSqlStore`/`CosmosNoSqlCollection`) instead of this legacy memory store.","Verify the API literal spelling against the `Literal[\"mongo-vcore\"]` type annotation in `create`."],"exampleFix":"// before\nstore = await AzureCosmosDBMemoryStore.create(\n    ..., cosmos_api=\"nosql\"  # not supported\n)\n\n// after\nstore = await AzureCosmosDBMemoryStore.create(\n    ..., cosmos_api=\"mongo-vcore\"\n)","handlingStrategy":"validation","validationCode":"SUPPORTED_COSMOS_API = {\"mongo-vcore\"}\n\ndef supported_cosmos_api(api: str) -> bool:\n    return api in SUPPORTED_COSMOS_API\n\n# assert supported_cosmos_api(cosmos_api) before calling create(...)","typeGuard":"def is_supported_cosmos_api(api) -> bool:\n    return api == \"mongo-vcore\"","tryCatchPattern":"from semantic_kernel.exceptions import MemoryConnectorInitializationError\ntry:\n    store = await AzureCosmosDBMemoryStore.create(..., cosmos_api=api)\nexcept MemoryConnectorInitializationError as e:\n    if \"not supported\" in str(e):\n        api = \"mongo-vcore\"  # or switch to the NoSQL vector-store connector\n        raise\n    raise","preventionTips":["Use `cosmos_api=\"mongo-vcore\"` (the only supported value) with a Cosmos DB for MongoDB vCore account.","For NoSQL API, use the newer `CosmosNoSqlStore`/`CosmosNoSqlCollection` connector.","Validate the API literal against the `Literal[\"mongo-vcore\"]` annotation before calling."],"tags":["azure-cosmos-db","api-type","validation","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}