{"record":{"id":"c9e80264167662bc","repo":"home-assistant/core","slug":"backup-manager-busy-self-state","errorCode":null,"errorMessage":"Backup manager busy: {self.state}","messagePattern":"Backup manager busy: (.+?)","errorType":"exception","errorClass":"BackupManagerError","httpStatus":null,"severity":"warning","filePath":"homeassistant/components/backup/manager.py","lineNumber":967,"sourceCode":"            for backup_id, error_dict in zip(backup_ids, delete_results, strict=True)\n            for error in error_dict.values()\n            if error and not isinstance(error, BackupNotFound)\n        }\n        if agent_errors:\n            LOGGER.error(\n                \"Error deleting old copies: %s\",\n                agent_errors,\n            )\n\n    async def async_receive_backup(\n        self,\n        *,\n        agent_ids: list[str],\n        contents: aiohttp.BodyPartReader,\n    ) -> str:\n        \"\"\"Receive and store a backup file from upload.\"\"\"\n        if self.state is not BackupManagerState.IDLE:\n            raise BackupManagerError(f\"Backup manager busy: {self.state}\")\n        self.async_on_backup_event(\n            ReceiveBackupEvent(\n                reason=None,\n                stage=None,\n                state=ReceiveBackupState.IN_PROGRESS,\n            )\n        )\n        try:\n            backup_id = await self._async_receive_backup(\n                agent_ids=agent_ids, contents=contents\n            )\n        except Exception:\n            self.async_on_backup_event(\n                ReceiveBackupEvent(\n                    reason=\"unknown_error\",\n                    stage=None,\n                    state=ReceiveBackupState.FAILED,\n                )","sourceCodeStart":949,"sourceCodeEnd":985,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/backup/manager.py#L949-L985","documentation":"Raised by BackupManager.async_receive_backup (the HTTP upload path for importing a backup file) when the manager's state is not BackupManagerState.IDLE. The manager is a single-flight state machine (IDLE/CREATE_BACKUP/RESTORE_BACKUP/RECEIVE_BACKUP...), so a second concurrent operation is rejected immediately.","triggerScenarios":"Uploading a backup file via the UI/API while another backup is being created, restored, or already uploading; two upload requests racing; retrying an upload before the previous attempt fully finished (state not yet reset to IDLE).","commonSituations":"User starts a second operation in another tab/device; automation triggers a backup while a manual upload is in progress; a restore still running in the background.","solutions":["Wait for the current operation to finish (watch the manager state / backup events) and retry the upload.","Check for in-progress operations via the backup websocket API or UI banner before uploading.","Serialize backup operations in scripts/automations (queue them) instead of firing concurrently."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from homeassistant.components.backup.manager import BackupManagerState\n\nif manager.state is not BackupManagerState.IDLE:\n    LOGGER.info(\"manager busy (%s); deferring upload\", manager.state)\n    return  # or subscribe to events and retry later","typeGuard":null,"tryCatchPattern":"from homeassistant.components.backup.manager import BackupManagerError\n\ntry:\n    backup_id = await manager.async_receive_backup(\n        agent_ids=agent_ids, contents=contents\n    )\nexcept BackupManagerError as err:\n    if \"busy\" in str(err):\n        raise HTTPTooManyRequests from err\n    raise","preventionTips":["Check manager.state is IDLE before starting uploads.","Serialize backup operations in automations (queue or lock).","Subscribe to backup events to know when the manager frees up."],"tags":["backup","concurrency","busy","upload"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}