{"record":{"id":"efdb18bfcd602c78","repo":"home-assistant/core","slug":"backup-backup-id-not-found-efdb18","errorCode":null,"errorMessage":"Backup {backup_id} not found","messagePattern":"Backup (.+?) not found","errorType":"exception","errorClass":"BackupNotFound","httpStatus":null,"severity":"error","filePath":"homeassistant/components/azure_storage/backup.py","lineNumber":126,"sourceCode":"    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\n    @handle_backup_errors\n    @override\n    async def async_download_backup(\n        self,\n        backup_id: str,\n        **kwargs: Any,\n    ) -> AsyncIterator[bytes]:\n        \"\"\"Download a backup file.\"\"\"\n        blob = await self._find_blob_by_backup_id(backup_id)\n        if blob is None:\n            # pylint: disable-next=home-assistant-exception-not-translated\n            raise BackupNotFound(f\"Backup {backup_id} not found\")\n        download_stream = await self._client.download_blob(blob.name)\n        return download_stream.chunks()\n\n    @handle_backup_errors\n    @override\n    async def async_upload_backup(\n        self,\n        *,\n        open_stream: Callable[[], Coroutine[Any, Any, AsyncIterator[bytes]]],\n        backup: AgentBackup,\n        on_progress: OnProgressCallback,\n        **kwargs: Any,\n    ) -> None:\n        \"\"\"Upload a backup.\"\"\"\n\n        metadata = {\n            \"metadata_version\": METADATA_VERSION,\n            \"backup_id\": backup.backup_id,","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/azure_storage/backup.py#L108-L144","documentation":"BackupNotFound raised in azure_storage async_download_backup when no blob's metadata matches the requested backup_id (checked via _find_blob_by_backup_id with metadata_version filtering). It tells the backup manager the requested backup no longer exists in the Azure container.","triggerScenarios":"Calling async_download_backup with a backup_id that has no matching blob metadata: blob deleted externally, uploaded with an older METADATA_VERSION, or metadata stripped by a lifecycle/copy process.","commonSituations":"Backup deleted from the Azure portal or by a lifecycle management policy, HA restored from a backup where the agent's backup list is stale, metadata_version bump between HA versions.","solutions":["Refresh the backup list (async_list_backups) and use an id that is currently present","If blobs exist but are not found, check their blob metadata has metadata_version matching METADATA_VERSION and a backup_id key","Remove stale entries by letting the manager reconcile, or delete and recreate the backup","Avoid external deletion; manage lifecycle through supported retention settings"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"backups = await agent.async_list_backups()\nids = {b.backup_id for b in backups}\nif backup_id not in ids:\n    # skip download, refresh UI list","typeGuard":"from homeassistant.components.backup.exceptions import BackupNotFound\n\ndef is_backup_not_found(err: BaseException) -> bool:\n    return isinstance(err, BackupNotFound)","tryCatchPattern":"try:\n    stream = await agent.async_download_backup(backup_id)\nexcept BackupNotFound:\n    # stale id: refresh list and inform user\n    ...","preventionTips":["Always validate backup_id against async_list_backups before download","Do not delete blobs out-of-band in the Azure portal","Watch METADATA_VERSION changes across HA upgrades"],"tags":["azure","blob-storage","backup","not-found"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}