microsoft/semantic-kernel · error · MemoryConnectorInitializationError

API type {cosmos_api} is not supported.

Error message

API type {cosmos_api} is not supported.

What it means

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`.

Source

Thrown at python/semantic_kernel/connectors/memory_stores/azure_cosmosdb/azure_cosmos_db_memory_store.py:125

            mongodb_client = MongoClient(
                cosmosdb_settings.connection_string.get_secret_value() if cosmosdb_settings.connection_string else None,
                appname=application_name,
            )
            database = mongodb_client[database_name]
            api_store = MongoStoreApi(
                collection_name=collection_name,
                index_name=index_name,
                vector_dimensions=vector_dimensions,
                num_lists=num_lists,
                similarity=similarity,
                database=database,
                kind=kind,
                m=m,
                ef_construction=ef_construction,
                ef_search=ef_search,
            )
        else:
            raise MemoryConnectorInitializationError(f"API type {cosmos_api} is not supported.")

        store = AzureCosmosDBMemoryStore(
            api_store,
            database_name,
            index_name,
            vector_dimensions,
            num_lists,
            similarity,
            kind,
            m,
            ef_construction,
            ef_search,
        )
        await store.create_collection(collection_name)
        return store

    async def create_collection(self, collection_name: str) -> None:
        """Creates a new collection in the data store.

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Use `cosmos_api="mongo-vcore"` (the only currently supported value) with an Azure Cosmos DB for MongoDB (vCore) account.
  2. If you need the Cosmos DB NoSQL API, use the newer vector-store connector (`CosmosNoSqlStore`/`CosmosNoSqlCollection`) instead of this legacy memory store.
  3. Verify the API literal spelling against the `Literal["mongo-vcore"]` type annotation in `create`.

Example fix

// before
store = await AzureCosmosDBMemoryStore.create(
    ..., cosmos_api="nosql"  # not supported
)

// after
store = await AzureCosmosDBMemoryStore.create(
    ..., cosmos_api="mongo-vcore"
)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_COSMOS_API = {"mongo-vcore"}

def supported_cosmos_api(api: str) -> bool:
    return api in SUPPORTED_COSMOS_API

# assert supported_cosmos_api(cosmos_api) before calling create(...)

Type guard

def is_supported_cosmos_api(api) -> bool:
    return api == "mongo-vcore"

Try / catch

from semantic_kernel.exceptions import MemoryConnectorInitializationError
try:
    store = await AzureCosmosDBMemoryStore.create(..., cosmos_api=api)
except MemoryConnectorInitializationError as e:
    if "not supported" in str(e):
        api = "mongo-vcore"  # or switch to the NoSQL vector-store connector
        raise
    raise

Prevention

When it happens

Trigger: Calling `AzureCosmosDBMemoryStore.create(..., cosmos_api="...")` with a value other than `"mongo-vcore"` (e.g. `"nosql"`, `"cassandra"`, `"table"`, or a typo).

Common situations: 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.

Related errors


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