{"record":{"id":"2c6d69d71309e891","repo":"microsoft/graphrag","slug":"cosmostableprovider-requires-database-name","errorCode":null,"errorMessage":"CosmosTableProvider requires 'database_name'.","messagePattern":"CosmosTableProvider requires 'database_name'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-storage/graphrag_storage/tables/cosmos_table_provider.py","lineNumber":91,"sourceCode":"        _container: ContainerProxy | None = None,\n        _legacy_container: ContainerProxy | None = None,\n        **kwargs: Any,\n    ) -> None:\n        self._batch_size = min(max(batch_size, 1), _MAX_BATCH_SIZE)\n\n        if _container is not None:\n            # Fast path: child() or test injection.\n            self._cosmos_client = _cosmos_client\n            self._container = _container\n            self._legacy_container = _legacy_container\n            self._namespace = namespace\n            self._owns_client = False\n            return\n\n        # Normal construction from config values.\n        if not database_name:\n            msg = \"CosmosTableProvider requires 'database_name'.\"\n            raise ValueError(msg)\n        if not container_name:\n            msg = \"CosmosTableProvider requires 'container_name'.\"\n            raise ValueError(msg)\n        if connection_string and account_url:\n            msg = \"Specify either 'connection_string' or 'account_url', not both.\"\n            raise ValueError(msg)\n        if not connection_string and not account_url:\n            msg = \"CosmosTableProvider requires 'connection_string' or 'account_url'.\"\n            raise ValueError(msg)\n\n        if connection_string:\n            self._cosmos_client = CosmosClient.from_connection_string(connection_string)\n        else:\n            self._cosmos_client = CosmosClient(\n                url=account_url,  # type: ignore[arg-type]\n                credential=DefaultAzureCredential(),\n            )\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-storage/graphrag_storage/tables/cosmos_table_provider.py#L73-L109","documentation":"CosmosTableProvider (the dataframe table backend for CosmosDB) requires a database_name because every container lives inside a database. The check runs in the config-based constructor path (it returns early when constructed from an existing client). It fires before any network call.","triggerScenarios":"Creating CosmosTableProvider via TableProviderFactory with type cosmosdb but no database_name in the table storage config, or instantiating it directly without database_name.","commonSituations":"settings.yaml defines cosmosdb credentials but omits the database_name key under table_storage; assuming the provider reads the database from the vector/storage config section instead.","solutions":["Add database_name to the table provider (table_storage) config section","Verify credentials were not the only keys copied from another cosmos config block","Ensure the database exists or the identity can create it"],"exampleFix":"# before\ntype: cosmosdb\nconnection_string: ${GRAPHRAG_COSMOS_CONN}\n# after\ntype: cosmosdb\nconnection_string: ${GRAPHRAG_COSMOS_CONN}\ndatabase_name: graphrag_tables","handlingStrategy":"validation","validationCode":"assert cfg.get(\"database_name\"), \"table_storage needs database_name for cosmosdb\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a config dataclass with required fields validated at load"],"tags":["cosmosdb","table-provider","config","validation"],"backgroundTag":"missing-required-config","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}