microsoft/semantic-kernel · error · MemoryConnectorInitializationError
Index Name cannot be empty.
Error message
Index Name cannot be empty.
What it means
Constructor guard in `AzureCosmosDBMemoryStore.__init__`: if `index_name is None` it raises `MemoryConnectorInitializationError`. An index (vector index) name is required for vector search configuration, so None is rejected. (As with the database-name check, only `None` is rejected — empty strings pass.)
Source
Thrown at python/semantic_kernel/connectors/memory_stores/azure_cosmosdb/azure_cosmos_db_memory_store.py:70
self,
cosmosStore: AzureCosmosDBStoreApi,
database_name: str,
index_name: str,
vector_dimensions: int,
num_lists: int = 100,
similarity: CosmosDBSimilarityType = CosmosDBSimilarityType.COS,
kind: CosmosDBVectorSearchType = CosmosDBVectorSearchType.VECTOR_HNSW,
m: int = 16,
ef_construction: int = 64,
ef_search: int = 40,
):
"""Initializes a new instance of the AzureCosmosDBMemoryStore class."""
if vector_dimensions <= 0:
raise MemoryConnectorInitializationError("Vector dimensions must be a positive number.")
if database_name is None:
raise MemoryConnectorInitializationError("Database Name cannot be empty.")
if index_name is None:
raise MemoryConnectorInitializationError("Index Name cannot be empty.")
self.cosmos_store = cosmosStore
self.index_name = index_name
self.num_lists = num_lists
self.similarity = similarity
self.kind = kind
self.m = m
self.ef_construction = ef_construction
self.ef_search = ef_search
@staticmethod
async def create(
database_name: str,
collection_name: str,
vector_dimensions: int,
num_lists: int,
similarity: CosmosDBSimilarityType,
kind: CosmosDBVectorSearchType,View on GitHub (pinned to c028a0c7dc)
Solutions
- Pass a non-None `index_name` (the name of the vector index to create/use in Cosmos).
- Populate the config/env var backing the index name before construction.
- Add your own empty-string check, since the library only guards None.
Example fix
// before store = AzureCosmosDBMemoryStore(cosmos_store, "db", None, vector_dimensions=1536) // after store = AzureCosmosDBMemoryStore(cosmos_store, "db", "vector-index", vector_dimensions=1536)
Defensive patterns
Strategy: validation
Validate before calling
def valid_index_name(name) -> bool:
return isinstance(name, str) and name.strip() != ""
# assert valid_index_name(index_name) before constructing the store Type guard
def is_non_empty_str(name) -> bool:
return isinstance(name, str) and name.strip() != "" Try / catch
from semantic_kernel.exceptions import MemoryConnectorInitializationError
try:
store = AzureCosmosDBMemoryStore(cs, "db", index_name, vector_dimensions=1536)
except MemoryConnectorInitializationError as e:
if "Index Name" in str(e):
raise SystemExit("provide a non-empty index_name") from e
raise Prevention
- Pass a non-empty `index_name` for the Cosmos vector index.
- Populate the config/env var backing the index name before construction.
- Guard empty strings yourself since the library only checks None.
When it happens
Trigger: Constructing the store with `index_name=None` (omitted/unset config value for the vector index name).
Common situations: Config field for the index name not set; passing a None variable by mistake; env var absent; argument-ordering error in the constructor call.
Related errors
- Database Name cannot be empty.
- Failed to create AstraDB settings.
- Dimensionality of {self._embedding_dim} exceeds the maximum
- Failed to create Azure Cognitive Search settings.
- Vector dimensions must be a positive number.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/15e27a8bb2fe8894.
Report an issue: GitHub.