microsoft/graphrag · error · ValueError
Either connection_string or account_url must be provided.
Error message
Either connection_string or account_url must be provided.
What it means
An internal consistency check in BlobWorkflowLogger.__init__: the code took the account_url branch (connection_string was falsy) but account_url is also None, meaning neither credential option is available. It is effectively unreachable if the earlier both-None check passed and a non-empty connection string exists; it fires when connection_string is empty string/whitespace (falsy but not None) and account_url is None.
Source
Thrown at packages/graphrag/graphrag/logger/blob_workflow_logger.py:52
if container_name is None:
msg = "No container name provided for blob storage."
raise ValueError(msg)
if connection_string is None and account_url is None:
msg = "No storage account blob url provided for blob storage."
raise ValueError(msg)
self._connection_string = connection_string
self.account_url = account_url
self._base_dir = base_dir
if self._connection_string:
self._blob_service_client = BlobServiceClient.from_connection_string(
self._connection_string
)
else:
if account_url is None:
msg = "Either connection_string or account_url must be provided."
raise ValueError(msg)
self._blob_service_client = BlobServiceClient(
account_url,
credential=DefaultAzureCredential(),
)
self._container_name = container_name
self._rotate_blob(blob_name or None)
def emit(self, record) -> None:
"""Emit a log record to blob storage."""
try:
# Create JSON structure based on record
log_data = {
"type": self._get_log_type(record.levelno),
"data": record.getMessage(),
}
View on GitHub (pinned to f40e9a26ce)
Solutions
- Ensure connection_string is a non-empty value, not '' — check the env var isn't defined-but-empty
- Pass a valid account_url when using DefaultAzureCredential instead of a connection string
- Trim/validate credential strings in config loading before constructing the logger
Example fix
# before BlobWorkflowLogger(container_name='c', connection_string=cfg.conn_str) # conn_str == '' # after conn = (cfg.conn_str or '').strip() BlobWorkflowLogger(container_name='c', connection_string=conn or None, account_url=cfg.account_url)
Defensive patterns
Strategy: validation
Validate before calling
conn = (cfg.connection_string or '').strip() url = (cfg.account_url or '').strip() assert conn or url, 'need connection_string or account_url' logger = BlobWorkflowLogger(container_name='c', connection_string=conn or None, account_url=url or None)
Prevention
- Treat empty credential strings as missing in config loaders
- Never define env vars as empty strings in .env templates
When it happens
Trigger: Passing connection_string='' (empty string) with account_url=None — the first check passes because connection_string is not None, but the falsy value routes to the else branch. Also any refactor that clears account_url between the two checks.
Common situations: Env var set but empty (AZURE_STORAGE_CONNECTION_STRING="" in .env); config templating that substitutes empty values; whitespace-only secrets in CI secrets.
Related errors
- No storage account blob url provided for blob storage.
- AzureBlobStorage requires only one of connection_string or a
- AzureBlobStorage requires either a connection_string or acco
- Blob storage does yet not support listing keys.
- Container name must be between 3 and 63 characters long and
AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27).
Data as JSON: /api/errors/5c359be58f906947.
Report an issue: GitHub.