{"record":{"id":"ea532919071c18f9","repo":"microsoft/semantic-kernel","slug":"the-name-of-the-azure-cosmos-db-nosql-database-is","errorCode":null,"errorMessage":"The name of the Azure Cosmos DB NoSQL database is missing.","messagePattern":"The name of the Azure Cosmos DB NoSQL database is missing\\.","errorType":"exception","errorClass":"VectorStoreInitializationException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/azure_cosmos_db.py","lineNumber":600,"sourceCode":"                                    Defaults to False.\n            env_file_path (str): The path to the .env file. Defaults to None.\n            env_file_encoding (str): The encoding of the .env file. Defaults to None.\n            credential: The credential to use for authentication to Azure Cosmos DB NoSQL.\n            kwargs: Additional keyword arguments.\n        \"\"\"\n        try:\n            cosmos_db_nosql_settings = CosmosNoSqlSettings(\n                url=url,\n                key=key,\n                database_name=database_name,\n                env_file_path=env_file_path,\n                env_file_encoding=env_file_encoding,\n            )\n        except ValidationError as e:\n            raise VectorStoreInitializationException(\"Failed to validate Azure Cosmos DB NoSQL settings.\") from e\n\n        if cosmos_db_nosql_settings.database_name is None:\n            raise VectorStoreInitializationException(\"The name of the Azure Cosmos DB NoSQL database is missing.\")\n\n        if cosmos_client is None:\n            if cosmos_db_nosql_settings.key is not None:\n                cosmos_client = CosmosClient(\n                    str(cosmos_db_nosql_settings.url), credential=cosmos_db_nosql_settings.key.get_secret_value()\n                )\n            else:\n                if credential is None:\n                    raise VectorStoreInitializationException(\n                        \"The 'credential' parameter is required for authentication.\"\n                    )\n                cosmos_client = CosmosClient(str(cosmos_db_nosql_settings.url), credential=credential)\n\n        super().__init__(\n            cosmos_client=cosmos_client,\n            database_name=cosmos_db_nosql_settings.database_name,\n            cosmos_db_nosql_settings=cosmos_db_nosql_settings,\n            create_database=create_database,","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/azure_cosmos_db.py#L582-L618","documentation":"After CosmosNoSqlSettings validates, the NoSQL base checks that database_name resolved to a non-None value. Cosmos requires a database name to operate, so an empty/None name is treated as a hard initialization failure distinct from generic settings validation.","triggerScenarios":"Raised in CosmosNoSqlBase.__init__ when cosmos_db_nosql_settings.database_name is None. Happens when no database_name was passed AND no corresponding environment variable is set, so the optional pydantic field stays None.","commonSituations":"Forgetting to pass database_name in local scripts. Missing the database-name env var in a container. Renaming the env var without updating deployment manifests.","solutions":["Pass database_name=\"mydb\" to the constructor.","Set the database-name environment variable (see CosmosNoSqlSettings alias).","Add the variable to your .env / deployment config and reload."],"exampleFix":"// before\nstore = CosmosNoSqlStore(url=url, key=key)\n// after\nstore = CosmosNoSqlStore(url=url, key=key, database_name=\"mydb\")","handlingStrategy":"validation","validationCode":"from semantic_kernel.connectors.azure_cosmos_db import CosmosNoSqlSettings\nimport os\n\ndb = database_name or os.getenv(\"COSMOS_DB_NOSQL_DATABASE\")  # confirm alias\nif not db:\n    raise ValueError(\"database_name must be provided for CosmosNoSqlStore\")\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass database_name explicitly in non-trivial deployments.","Document required env vars (account URL, key, database) together.","Add a startup self-check that fails fast on missing database."],"tags":["azure-cosmos-db","vector-store","initialization","configuration"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}