{"record":{"id":"2f00ac769ce7ea5c","repo":"home-assistant/core","slug":"at-least-one-available-backup-agent-must-be-select","errorCode":null,"errorMessage":"At least one available backup agent must be selected, got {agent_ids}","messagePattern":"At least one available backup agent must be selected, got (.+?)","errorType":"exception","errorClass":"BackupManagerError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/backup/manager.py","lineNumber":1176,"sourceCode":"        include_all_addons: bool,\n        include_database: bool,\n        include_folders: list[Folder] | None,\n        include_homeassistant: bool,\n        name: str | None,\n        password: str | None,\n        raise_task_error: bool,\n        with_automatic_settings: bool,\n    ) -> NewBackup:\n        \"\"\"Initiate generating a backup.\"\"\"\n        unavailable_agents = [\n            agent_id for agent_id in agent_ids if agent_id not in self.backup_agents\n        ]\n        if not (\n            available_agents := [\n                agent_id for agent_id in agent_ids if agent_id in self.backup_agents\n            ]\n        ):\n            raise BackupManagerError(\n                f\"At least one available backup agent must be selected, got {agent_ids}\"\n            )\n        if unavailable_agents:\n            LOGGER.warning(\n                \"Backup agents %s are not available, will backup to %s\",\n                unavailable_agents,\n                available_agents,\n            )\n        if include_all_addons and include_addons:\n            raise BackupManagerError(\n                \"Cannot include all addons and specify specific addons\"\n            )\n\n        kind = \"Automatic\" if with_automatic_settings else \"Custom\"\n        backup_name = (\n            name if name is None else name.strip()\n        ) or f\"{kind} backup {HAVERSION}\"\n        extra_metadata = extra_metadata or {}","sourceCodeStart":1158,"sourceCodeEnd":1194,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/backup/manager.py#L1158-L1194","documentation":"Raised by BackupManager.async_create_backup when none of the requested agent_ids is a registered, available backup agent. The manager splits the request into available_agents and unavailable_agents; if the available list is empty it refuses to start — a backup would have nowhere to be stored (including the local agent, which counts as an agent).","triggerScenarios":"Calling async_create_backup with agent_ids=[] (or only unknown/unloaded agents); passing a domain string like 'backblaze' instead of the full agent_id 'backblaze_b2.xxx'; the target agent's config entry being disabled/unloaded so it is not in manager.backup_agents.","commonSituations":"Scripts/websocket calls passing malformed agent IDs; the named network agent was removed or its integration entry disabled; passing empty list expecting a default (there is none — local agent must be requested explicitly as 'backup.local').","solutions":["Fetch valid IDs first: use the manager's backup_agents keys (or the UI's agent list) and pass those.","Include the local agent ('backup.local') if local storage is acceptable.","Re-enable/reload the integration providing the target agent, then retry.","Use exact agent IDs (integration domain + entry suffix), not bare integration domains."],"exampleFix":"# before\nawait manager.async_create_backup(agent_ids=[\"backblaze\"], ...)\n\n# after\nvalid = list(manager.backup_agents)  # e.g. ['backup.local', 'backblaze_b2.abcdef']\nawait manager.async_create_backup(agent_ids=valid, ...)","handlingStrategy":"validation","validationCode":"valid_agents = [\n    a for a in agent_ids if a in manager.backup_agents\n]\nif not valid_agents:\n    raise ValueError(\n        f\"no valid agents in {agent_ids}; known: {list(manager.backup_agents)}\"\n    )","typeGuard":null,"tryCatchPattern":"from homeassistant.components.backup.manager import BackupManagerError\n\ntry:\n    await manager.async_create_backup(agent_ids=agent_ids, ...)\nexcept BackupManagerError as err:\n    if \"must be selected\" in str(err):\n        agent_ids = list(manager.backup_agents)\n        await manager.async_create_backup(agent_ids=agent_ids, ...)\n    else:\n        raise","preventionTips":["Always derive agent_ids from manager.backup_agents, never hardcode them.","Use full agent IDs (domain + entry suffix).","Include 'backup.local' when local storage is an acceptable fallback."],"tags":["backup","agent-selection","validation","create-backup"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}