{"record":{"id":"6cd167e4cf5da35c","repo":"home-assistant/core","slug":"error-during-backup-operation-in-func-name-6cd167","errorCode":null,"errorMessage":"Error during backup operation in {func.__name__}: {err}","messagePattern":"Error during backup operation in (.+?): (.+?)","errorType":"exception","errorClass":"BackupAgentError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/azure_storage/backup.py","lineNumber":96,"sourceCode":"            # pylint: disable-next=home-assistant-exception-not-translated\n            raise BackupAgentError(\n                f\"Error during backup operation in {func.__name__}:\"\n                f\" Status {err.status_code}, message: {err.message}\"\n            ) from err\n        except ServiceRequestError as err:\n            # pylint: disable-next=home-assistant-exception-not-translated\n            raise BackupAgentError(\n                f\"Timeout during backup operation in {func.__name__}\"\n            ) from err\n        except AzureError as err:\n            _LOGGER.debug(\n                \"Error during backup in %s: %s\",\n                func.__name__,\n                err,\n                exc_info=True,\n            )\n            # pylint: disable-next=home-assistant-exception-not-translated\n            raise BackupAgentError(\n                f\"Error during backup operation in {func.__name__}: {err}\"\n            ) from err\n\n    return wrapper\n\n\nclass AzureStorageBackupAgent(BackupAgent):\n    \"\"\"Azure storage backup agent.\"\"\"\n\n    domain = DOMAIN\n\n    def __init__(self, hass: HomeAssistant, entry: AzureStorageConfigEntry) -> None:\n        \"\"\"Initialize the Azure storage backup agent.\"\"\"\n        super().__init__()\n        self._client = entry.runtime_data\n        self.name = entry.title\n        self.unique_id = entry.entry_id\n","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/azure_storage/backup.py#L78-L114","documentation":"BackupAgentError raised by handle_backup_errors as the catch-all for any azure.core.exceptions.AzureError that is not HttpResponseError or ServiceRequestError, during Azure Storage backup operations. The original error text is embedded via str(err). This covers SDK/client-level failures outside plain HTTP responses.","triggerScenarios":"Decorated backup methods raise an AzureError subclass such as ClientAuthenticationError mid-operation (SAS expiring during a long upload) or HttpResponseError edge subclasses not matched earlier.","commonSituations":"SAS token expiring during a multi-hour backup upload, credential/permission revocation mid-session, SDK internal errors after connection pool exhaustion.","solutions":["Inspect the embedded error text and the debug log (exc_info=True) to identify the underlying AzureError","ClientAuthenticationError mid-operation: reissue credentials in the integration and retry the backup","For long uploads, prefer account-key or non-expiring auth over short-lived SAS tokens","Retry the backup after fixing the underlying cause; the backup agent reports failure to the backup manager"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def is_azure_error(err: BaseException) -> bool:\n    from azure.core.exceptions import AzureError, HttpResponseError, ServiceRequestError\n    return isinstance(err, AzureError) and not isinstance(err, (HttpResponseError, ServiceRequestError))","tryCatchPattern":"except AzureError as err:\n    _LOGGER.debug(\"Error during backup in %s: %s\", func.__name__, err, exc_info=True)\n    raise BackupAgentError(f\"Error during backup operation in {func.__name__}: {err}\") from err","preventionTips":["Use non-expiring credentials for accounts used by long backup runs","Branch on __cause__ when handling the wrapped BackupAgentError","Keep debug logs on during backup windows to capture the underlying AzureError"],"tags":["azure","blob-storage","backup","catch-all"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}