{"record":{"id":"9cacf2206a113181","repo":"home-assistant/core","slug":"cannot-include-all-addons-and-specify-specific-add","errorCode":null,"errorMessage":"Cannot include all addons and specify specific addons","messagePattern":"Cannot include all addons and specify specific addons","errorType":"exception","errorClass":"BackupManagerError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/backup/manager.py","lineNumber":1186,"sourceCode":"        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 {}\n\n        try:\n            (\n                new_backup,\n                self._backup_task,\n            ) = await self._reader_writer.async_create_backup(\n                agent_ids=available_agents,\n                backup_name=backup_name,\n                extra_metadata=extra_metadata\n                | {","sourceCodeStart":1168,"sourceCodeEnd":1204,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/backup/manager.py#L1168-L1204","documentation":"Raised by BackupManager.async_create_backup when the request sets both include_all_addons=True and a non-empty include_addons list. The two options are mutually exclusive: either back up every addon or an explicit list — the manager refuses to guess the union.","triggerScenarios":"Calling async_create_backup (or the websocket create-backup service) with include_all_addons=True and include_addons=[\"addon_slug\", ...]; typically a UI/client bug that sends both fields with their defaults rather than omitting one.","commonSituations":"Custom scripts or API clients copying a full parameter dict and flipping include_all_addons without clearing include_addons; frontend bugs after API changes.","solutions":["Pick one: either include_all_addons=True with include_addons=None/omitted, or include_all_addons=False/omitted with the explicit list.","Build the request kwargs conditionally instead of passing every field unconditionally.","Update API clients to the current backup websocket schema (fields should be omitted, not defaulted)."],"exampleFix":"# before\nawait manager.async_create_backup(\n    include_all_addons=True,\n    include_addons=[\"core_mosquitto\"],  # conflict\n    ...,\n)\n\n# after\nawait manager.async_create_backup(\n    include_all_addons=True,\n    ...,\n)  # include_addons omitted","handlingStrategy":"validation","validationCode":"if include_all_addons and include_addons:\n    raise ValueError(\"choose either include_all_addons or include_addons\")","typeGuard":null,"tryCatchPattern":"from homeassistant.components.backup.manager import BackupManagerError\n\ntry:\n    await manager.async_create_backup(\n        include_all_addons=include_all_addons,\n        include_addons=None if include_all_addons else include_addons,\n        ...,\n    )\nexcept BackupManagerError as err:\n    if \"Cannot include all addons\" in str(err):\n        # fix request and retry once\n        ...\n    raise","preventionTips":["Build create-backup kwargs conditionally; omit mutually exclusive fields.","Validate request payloads against the backup websocket schema before sending."],"tags":["backup","addons","validation","create-backup"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}