{"record":{"id":"5a4e5e36e79bf870","repo":"microsoft/graphrag","slug":"cosmostableprovider-requires-connection-string-o","errorCode":null,"errorMessage":"CosmosTableProvider requires 'connection_string' or 'account_url'.","messagePattern":"CosmosTableProvider requires 'connection_string' or 'account_url'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-storage/graphrag_storage/tables/cosmos_table_provider.py","lineNumber":100,"sourceCode":"            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\n        self._namespace = namespace\n        self._owns_client = True\n\n        # Containers are created lazily on first use via _ensure_container().\n        self._database_name = database_name\n        self._container_name = container_name\n        self._legacy_container_name = legacy_container\n        self._container: ContainerProxy | None = None  # type: ignore[assignment]\n        self._legacy_container: ContainerProxy | None = None","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-storage/graphrag_storage/tables/cosmos_table_provider.py#L82-L118","documentation":"CosmosTableProvider's constructor verifies that at least one endpoint credential (connection_string or account_url) is present after the mutual-exclusion check. With neither, no Cosmos client can be built, so it fails fast with a clear config error.","triggerScenarios":"Creating CosmosTableProvider from config where both credential fields are absent — unset env vars, empty YAML placeholders, or a secrets file not loaded.","commonSituations":"CI/CD job missing the cosmos secret; local run without .env loaded; placeholder values like ${VAR} left unresolved because the var is undefined.","solutions":["Provide connection_string or url in the table provider config","Verify the corresponding env var is exported in the runtime (echo $VAR)","For url auth, ensure DefaultAzureCredential works (az login locally, managed identity in Azure)"],"exampleFix":"# before\ntype: cosmosdb\ndatabase_name: graphrag\ncontainer_name: tables\n# after\ntype: cosmosdb\ndatabase_name: graphrag\ncontainer_name: tables\nconnection_string: ${GRAPHRAG_COSMOS_CONN}","handlingStrategy":"validation","validationCode":"assert cfg.get(\"connection_string\") or cfg.get(\"url\"), \"cosmos table provider needs a credential\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Startup config check that fails before any pipeline work","Document required env vars per environment"],"tags":["cosmosdb","credentials","table-provider","missing-env-var"],"backgroundTag":"missing-credentials","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}