{"record":{"id":"effbd9e43c01e7dd","repo":"infiniflow/ragflow","slug":"azure-blob-connection-string-is-required-for-the","errorCode":null,"errorMessage":"Azure Blob: connection_string is required for the connection_string auth mode","messagePattern":"Azure Blob: connection_string is required for the connection_string auth mode","errorType":"validation","errorClass":"ConnectorMissingCredentialError","httpStatus":null,"severity":"error","filePath":"common/data_source/azure_blob_connector.py","lineNumber":139,"sourceCode":"\n        # Honor the explicitly selected auth mode. The UI hides inactive\n        # credential fields but does not clear them, so a user who fills one\n        # mode and then switches can leave stale values behind; selecting by\n        # field precedence would then authenticate with the wrong mode.\n        # Fall back to precedence only when no auth_mode was supplied.\n        mode = self.auth_mode\n        if not mode:\n            if conn_str:\n                mode = \"connection_string\"\n            elif account_name and account_key:\n                mode = \"account_key\"\n            elif container_url and sas_token:\n                mode = \"sas_token\"\n\n        try:\n            if mode == \"connection_string\":\n                if not conn_str:\n                    raise ConnectorMissingCredentialError(\"Azure Blob: connection_string is required for the connection_string auth mode\")\n                if not container_name:\n                    raise ConnectorMissingCredentialError(\"Azure Blob: container_name is required together with connection_string\")\n                svc = BlobServiceClient.from_connection_string(conn_str)\n                self._container_client = svc.get_container_client(container_name)\n            elif mode == \"account_key\":\n                if not (account_name and account_key):\n                    raise ConnectorMissingCredentialError(\"Azure Blob: account_name and account_key are required for the account_key auth mode\")\n                if not container_name:\n                    raise ConnectorMissingCredentialError(\"Azure Blob: container_name is required together with account_name + account_key\")\n                account_url = f\"https://{account_name}.{_AZURE_ENDPOINT_SUFFIX}\"\n                svc = BlobServiceClient(\n                    account_url=account_url,\n                    credential=account_key,\n                )\n                self._container_client = svc.get_container_client(container_name)\n            elif mode == \"sas_token\":\n                if not (container_url and sas_token):\n                    raise ConnectorMissingCredentialError(\"Azure Blob: container_url and sas_token are required for the sas_token auth mode\")","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/azure_blob_connector.py#L121-L157","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add container_name to the Azure Blob data source configuration when using connection_string auth.","If you meant a different auth mode, set auth_mode explicitly (account_key or sas_token) and supply its required fields instead.","Verify the container exists in the storage account (typos in container_name surface later as 404s)."],"exampleFix":"# before\n{\"auth_mode\": \"connection_string\", \"connection_string\": \"DefaultEndpoints...\", \"container_name\": \"\"}\n# after\n{\"auth_mode\": \"connection_string\", \"connection_string\": \"DefaultEndpoints...\", \"container_name\": \"my-container\"}","handlingStrategy":"validation","validationCode":"if (cfg.get(\"auth_mode\") or (\"connection_string\" if cfg.get(\"connection_string\") else None)) == \"connection_string\":\n    if not cfg.get(\"connection_string\"):\n        raise ValueError(\"connection_string required for connection_string mode\")\n    if not cfg.get(\"container_name\"):\n        raise ValueError(\"container_name required with connection_string\")","typeGuard":"def is_complete_azure_connstr_config(cfg: dict) -> bool:\n    return bool(cfg.get(\"connection_string\")) and bool(cfg.get(\"container_name\"))","tryCatchPattern":"from common.data_source.azure_blob_connector import ConnectorMissingCredentialError\ntry:\n    connector = AzureBlobConnector(**cfg)\n    connector.connect()\nexcept ConnectorMissingCredentialError as e:\n    log.error(\"azure config incomplete: %s\", e)\n    # surface field-level error to the data-source settings form\n    raise","preventionTips":["Remember mode inference: connection_string presence selects connection_string mode unless auth_mode is explicit.","Always pair a connection string with container_name in the settings form.","Validate the full credential set before creating the data source."],"tags":["connectors","azure","blob-storage","credentials","configuration"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}