infiniflow/ragflow · error · ConnectorMissingCredentialError

Azure Blob: container_name is required together with connect

Error message

Azure Blob: container_name is required together with connection_string

What it means

ConnectorMissingCredentialError raised in the connection_string branch of the Azure Blob connector (common/data_source/azure_blob_connector.py:141-142). Even with a valid connection string, the SDK call BlobServiceClient.from_connection_string(conn_str).get_container_client(container_name) needs a concrete container; when conn_str is present but container_name is empty/None the connector refuses to construct a client. This is the sibling check of the 'connection_string is required' error — both validate the connection_string mode's two required fields.

Source

Thrown at common/data_source/azure_blob_connector.py:141

        # 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")
                # mirrors RAGFlowAzureSasBlob; strip a leading "?" so we
                # never produce a double-"?" that breaks SAS auth.

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set container_name to the target blob container's name in the data source config.
  2. Confirm the value is non-empty after trimming — an empty string fails the same check.
  3. If unsure of the container name, list containers (az storage container list --connection-string ...) and use the exact name.

Example fix

# before
{"connection_string": cs, "container_name": null}
# after
{"connection_string": cs, "container_name": "ragflow-docs"}
Defensive patterns

Strategy: validation

Validate before calling

if not (cfg.get("connection_string") and cfg.get("container_name", "").strip()):
    raise ValueError("connection_string mode needs both connection_string and a non-empty container_name")

Type guard

def azure_connstr_mode_complete(cfg: dict) -> bool:
    return bool(cfg.get("connection_string")) and bool(str(cfg.get("container_name") or "").strip())

Try / catch

try:
    client = build_container_client(cfg)
except ConnectorMissingCredentialError as e:
    if "container_name is required together with connection_string" in str(e):
        cfg["container_name"] = prompt_user_for_container()
        client = build_container_client(cfg)
    else:
        raise

Prevention

When it happens

Trigger: Data source config with connection_string set and auth mode resolving to connection_string (explicitly or by inference) while container_name is omitted, None, or an empty string.

Common situations: Minimal config tested with just the connection string; UI form allowing submit without container; config generation code that only conditionally includes container_name.

Related errors


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