{"record":{"id":"235bf8545880b82e","repo":"home-assistant/core","slug":"home-assistant-must-be-included-in-backup","errorCode":null,"errorMessage":"Home Assistant must be included in backup","messagePattern":"Home Assistant must be included in backup","errorType":"exception","errorClass":"BackupReaderWriterError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/backup/manager.py","lineNumber":1739,"sourceCode":"        extra_metadata: dict[str, bool | str],\n        include_addons: list[str] | None,\n        include_all_addons: bool,\n        include_database: bool,\n        include_folders: list[Folder] | None,\n        include_homeassistant: bool,\n        on_progress: Callable[[CreateBackupEvent], None],\n        password: str | None,\n    ) -> tuple[NewBackup, asyncio.Task[WrittenBackup]]:\n        \"\"\"Initiate generating a backup.\"\"\"\n        date_str = dt_util.now().isoformat()\n        backup_id = _generate_backup_id(date_str, backup_name)\n\n        if include_addons or include_all_addons or include_folders:\n            raise BackupReaderWriterError(\n                \"Addons and folders are not supported by core backup\"\n            )\n        if not include_homeassistant:\n            raise BackupReaderWriterError(\"Home Assistant must be included in backup\")\n\n        backup_task = self._hass.async_create_task(\n            self._async_create_backup(\n                agent_ids=agent_ids,\n                backup_id=backup_id,\n                backup_name=backup_name,\n                extra_metadata=extra_metadata,\n                include_database=include_database,\n                date_str=date_str,\n                on_progress=on_progress,\n                password=password,\n            ),\n            name=\"backup_manager_create_backup\",\n            eager_start=False,  # To ensure the task is not started before we return\n        )\n\n        return (NewBackup(backup_job_id=backup_id), backup_task)\n","sourceCodeStart":1721,"sourceCodeEnd":1757,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/backup/manager.py#L1721-L1757","documentation":"BackupReaderWriterError raised when creating a core backup with include_homeassistant=False. The core backup format is the Home Assistant configuration directory archive; a core backup that excludes Home Assistant itself would be empty, so HA rejects it.","triggerScenarios":"Calling the core backup creation API with include_homeassistant set to False (while the addon/folder flags are already clean).","commonSituations":"A client forwards a full backup-options form and passes include_homeassistant: false; script built for agent-only backups assumes the flag is honored; UI payload built by concatenating optional flags defaults wrongly.","solutions":["Always pass include_homeassistant=True for core backups","If you only wanted to trigger an agent-side backup, use the agent's own API rather than the core create flow","Audit the create-backup payload construction to stop forwarding unsupported combinations"],"exampleFix":"// before\n{\"include_homeassistant\": false, \"include_database\": true}\n// after\n{\"include_homeassistant\": true, \"include_database\": true}","handlingStrategy":"validation","validationCode":"assert include_homeassistant, \"Core backups must include Home Assistant\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never forward include_homeassistant=false to the core create flow","Validate the payload client-side: reject empty backup requests","Treat include_homeassistant as mandatory in any core-backup helper you write"],"tags":["home-assistant","backup","validation"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}