{"record":{"id":"340a6086b643d445","repo":"infiniflow/ragflow","slug":"azure-blob-container-name-is-required-together-wi","errorCode":null,"errorMessage":"Azure Blob: container_name is required together with connection_string","messagePattern":"Azure Blob: container_name is required together with connection_string","errorType":"validation","errorClass":"ConnectorMissingCredentialError","httpStatus":null,"severity":"error","filePath":"common/data_source/azure_blob_connector.py","lineNumber":141,"sourceCode":"        # 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\")\n                # mirrors RAGFlowAzureSasBlob; strip a leading \"?\" so we\n                # never produce a double-\"?\" that breaks SAS auth.","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/azure_blob_connector.py#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"Minimal config tested with just the connection string; UI form allowing submit without container; config generation code that only conditionally includes container_name.","solutions":["Set container_name to the target blob container's name in the data source config.","Confirm the value is non-empty after trimming — an empty string fails the same check.","If unsure of the container name, list containers (az storage container list --connection-string ...) and use the exact name."],"exampleFix":"# before\n{\"connection_string\": cs, \"container_name\": null}\n# after\n{\"connection_string\": cs, \"container_name\": \"ragflow-docs\"}","handlingStrategy":"validation","validationCode":"if not (cfg.get(\"connection_string\") and cfg.get(\"container_name\", \"\").strip()):\n    raise ValueError(\"connection_string mode needs both connection_string and a non-empty container_name\")","typeGuard":"def azure_connstr_mode_complete(cfg: dict) -> bool:\n    return bool(cfg.get(\"connection_string\")) and bool(str(cfg.get(\"container_name\") or \"\").strip())","tryCatchPattern":"try:\n    client = build_container_client(cfg)\nexcept ConnectorMissingCredentialError as e:\n    if \"container_name is required together with connection_string\" in str(e):\n        cfg[\"container_name\"] = prompt_user_for_container()\n        client = build_container_client(cfg)\n    else:\n        raise","preventionTips":["Make container_name a required field in the Azure data-source form when connection_string is used.","List containers with az CLI to copy the exact name.","Blank strings fail the check — validate after trimming."],"tags":["connectors","azure","blob-storage","configuration"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}