{"record":{"id":"90b0c6525d6faba1","repo":"home-assistant/core","slug":"error-during-backup-operation-in-func-name","errorCode":null,"errorMessage":"Error during backup operation in {func.__name__}: Status {err.status_code}, message: {err.message}","messagePattern":"Error during backup operation in (.+?): Status (.+?), message: (.+?)","errorType":"exception","errorClass":"BackupAgentError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/azure_storage/backup.py","lineNumber":79,"sourceCode":") -> Callable[Concatenate[AzureStorageBackupAgent, P], Coroutine[Any, Any, _R]]:\n    \"\"\"Handle backup errors.\"\"\"\n\n    @wraps(func)\n    async def wrapper(\n        self: AzureStorageBackupAgent, *args: P.args, **kwargs: P.kwargs\n    ) -> _R:\n        try:\n            return await func(self, *args, **kwargs)\n        except HttpResponseError as err:\n            _LOGGER.debug(\n                \"Error during backup in %s: Status %s, message %s\",\n                func.__name__,\n                err.status_code,\n                err.message,\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__}:\"\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}\"","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/azure_storage/backup.py#L61-L97","documentation":"BackupAgentError raised by the handle_backup_errors decorator in azure_storage/backup.py when a backup operation (upload/download/delete/list) fails with azure.core.exceptions.HttpResponseError. It wraps HTTP-level failures from the Blob service (4xx/5xx with status_code and message) and is logged at debug with the full traceback before re-raising.","triggerScenarios":"Any decorated method (async_download_backup, async_upload_backup, async_delete_backup, async_get_backup) triggers an HttpResponseError, e.g. 404 on download_blob of a deleted blob, 412 precondition failure, or 503 server busy.","commonSituations":"Blob deleted between list and download (race), container permissions changed mid-operation, Azure throttling during large backup uploads, partial metadata causing wrong blob names.","solutions":["Read the Status and message in the exception (also in debug logs) to identify the HTTP failure mode","404: the blob vanished (e.g. deleted outside HA); refresh the backup list and retry with an existing backup id","429/503: retry after a delay; Azure SDK retries are exhausted — reduce backup size or schedule","403: re-authenticate the integration (SAS/key rotation invalidates the stored client)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def is_http_response_error(err: BaseException) -> bool:\n    from azure.core.exceptions import HttpResponseError\n    return isinstance(err, HttpResponseError)","tryCatchPattern":"from homeassistant.components.backup.exceptions import BackupAgentError\ntry:\n    async for chunk in await agent.async_download_backup(backup_id):\n        ...\nexcept BackupAgentError as err:\n    # inspect err.__cause__ for status_code / message\n    ...","preventionTips":["Always check backup existence via async_get_backup/list before acting on an id","Enable debug logging for the azure_storage integration to capture status codes","Handle BackupAgentError at the caller and branch on __cause__ type"],"tags":["azure","blob-storage","backup","http-error"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}