infiniflow/ragflow · error · ConnectorMissingCredentialError

Azure Blob: connection_string is required for the connection

Error message

Azure Blob: connection_string is required for the connection_string auth mode

What it means

ConnectorMissingCredentialError from the Azure Blob connector's client-construction logic (common/data_source/azure_blob_connector.py:134-140). The connector infers an auth mode from which fields were supplied: conn_str → connection_string mode, account_name+account_key → account_key mode, container_url+sas_token → sas_token mode. If auth_mode is explicitly 'connection_string' (or inferred because conn_str is set) but container_name is missing, construction fails — a connection string without a container cannot identify the blob container to read.

Source

Thrown at common/data_source/azure_blob_connector.py:139

        # Honor the explicitly selected auth mode. The UI hides inactive
        # credential fields but does not clear them, so a user who fills one
        # mode and then switches can leave stale values behind; selecting by
        # field precedence would then authenticate with the wrong mode.
        # Fall back to precedence only when no auth_mode was supplied.
        mode = self.auth_mode
        if not mode:
            if conn_str:
                mode = "connection_string"
            elif account_name and account_key:
                mode = "account_key"
            elif container_url and sas_token:
                mode = "sas_token"

        try:
            if mode == "connection_string":
                if not conn_str:
                    raise ConnectorMissingCredentialError("Azure Blob: connection_string is required for the connection_string auth mode")
                if not container_name:
                    raise ConnectorMissingCredentialError("Azure Blob: container_name is required together with connection_string")
                svc = BlobServiceClient.from_connection_string(conn_str)
                self._container_client = svc.get_container_client(container_name)
            elif mode == "account_key":
                if not (account_name and account_key):
                    raise ConnectorMissingCredentialError("Azure Blob: account_name and account_key are required for the account_key auth mode")
                if not container_name:
                    raise ConnectorMissingCredentialError("Azure Blob: container_name is required together with account_name + account_key")
                account_url = f"https://{account_name}.{_AZURE_ENDPOINT_SUFFIX}"
                svc = BlobServiceClient(
                    account_url=account_url,
                    credential=account_key,
                )
                self._container_client = svc.get_container_client(container_name)
            elif mode == "sas_token":
                if not (container_url and sas_token):
                    raise ConnectorMissingCredentialError("Azure Blob: container_url and sas_token are required for the sas_token auth mode")

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Add container_name to the Azure Blob data source configuration when using connection_string auth.
  2. If you meant a different auth mode, set auth_mode explicitly (account_key or sas_token) and supply its required fields instead.
  3. Verify the container exists in the storage account (typos in container_name surface later as 404s).

Example fix

# before
{"auth_mode": "connection_string", "connection_string": "DefaultEndpoints...", "container_name": ""}
# after
{"auth_mode": "connection_string", "connection_string": "DefaultEndpoints...", "container_name": "my-container"}
Defensive patterns

Strategy: validation

Validate before calling

if (cfg.get("auth_mode") or ("connection_string" if cfg.get("connection_string") else None)) == "connection_string":
    if not cfg.get("connection_string"):
        raise ValueError("connection_string required for connection_string mode")
    if not cfg.get("container_name"):
        raise ValueError("container_name required with connection_string")

Type guard

def is_complete_azure_connstr_config(cfg: dict) -> bool:
    return bool(cfg.get("connection_string")) and bool(cfg.get("container_name"))

Try / catch

from common.data_source.azure_blob_connector import ConnectorMissingCredentialError
try:
    connector = AzureBlobConnector(**cfg)
    connector.connect()
except ConnectorMissingCredentialError as e:
    log.error("azure config incomplete: %s", e)
    # surface field-level error to the data-source settings form
    raise

Prevention

When it happens

Trigger: Configuring an Azure Blob data source with auth_mode: connection_string (or supplying connection_string) but omitting container_name; also when mode defaults to connection_string from a stray conn_str while the user intended sas_token/account_key auth and left container_name blank.

Common situations: Copy-pasting the Azure Storage connection string from the portal but forgetting the container field; misordered config keys after migration; explicit auth_mode left over from a template while the actual credentials belong to a different mode.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/effbd9e43c01e7dd. Report an issue: GitHub.