{"record":{"id":"6566a399c9b44a32","repo":"home-assistant/core","slug":"backup-integration-is-not-available","errorCode":null,"errorMessage":"Backup integration is not available","messagePattern":"Backup integration is not available","errorType":"exception","errorClass":"HomeAssistantError","httpStatus":null,"severity":"error","filePath":"homeassistant/components/backup/__init__.py","lineNumber":152,"sourceCode":"\n    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)\n\n    return True\n\n\nasync def async_unload_entry(hass: HomeAssistant, entry: BackupConfigEntry) -> bool:\n    \"\"\"Unload a config entry.\"\"\"\n    return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)\n\n\n@callback\ndef async_get_manager(hass: HomeAssistant) -> BackupManager:\n    \"\"\"Get the backup manager instance.\n\n    Raises HomeAssistantError if the backup integration is not available.\n    \"\"\"\n    if DATA_MANAGER not in hass.data:\n        raise HomeAssistantError(\"Backup integration is not available\")\n\n    return hass.data[DATA_MANAGER]\n","sourceCodeStart":134,"sourceCodeEnd":155,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/backup/__init__.py#L134-L155","documentation":"Raised by homeassistant.components.backup.async_get_manager when the backup integration's manager is not yet (or no longer) in hass.data. Every consumer of backup functionality goes through this helper, so the error means the 'backup' integration is not set up in this Home Assistant instance at the moment of the call.","triggerScenarios":"Calling async_get_manager(hass) before the backup integration has finished setup (e.g., during startup, from another integration's async_setup that runs before 'backup' loads), after the backup config entry was unloaded/removed, or in a context (custom component, script at import time) where the integration was never loaded.","commonSituations":"Custom integrations or automations that call backup manager APIs at startup; the backup integration entry was disabled or deleted by the user; test harnesses that create hass without setting up the backup integration.","solutions":["Make sure the 'backup' integration is installed and enabled (it is loaded via a config entry in the default setup).","Defer the call until after HOMEASSISTANT_STARTED (or await async_setup of the backup component) instead of calling during setup of another integration.","In tests, set up the backup integration with the standard mock/setup helpers so DATA_MANAGER is populated.","Handle HomeAssistantError from async_get_manager and surface a clear 'backup integration not available' state instead of crashing."],"exampleFix":"// before\nfrom homeassistant.components.backup import async_get_manager\nmanager = async_get_manager(hass)  # may raise during startup\n\n// after\nfrom homeassistant.components.backup import async_get_manager\nfrom homeassistant.exceptions import HomeAssistantError\n\nasync def async_setup(hass, config):\n    async def _start(_):\n        try:\n            manager = async_get_manager(hass)\n        except HomeAssistantError:\n            _LOGGER.error(\"Backup integration is not available\")\n            return\n        ...\n    hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _start)","handlingStrategy":"validation","validationCode":"from homeassistant.core import HomeAssistant\nfrom homeassistant.components.backup import DATA_MANAGER\n\ndef backup_available(hass: HomeAssistant) -> bool:\n    return DATA_MANAGER in hass.data","typeGuard":"def backup_available(hass: HomeAssistant) -> TypeGuard[HomeAssistant]:\n    return DATA_MANAGER in hass.data","tryCatchPattern":"from homeassistant.exceptions import HomeAssistantError\nfrom homeassistant.components.backup import async_get_manager\n\ntry:\n    manager = async_get_manager(hass)\nexcept HomeAssistantError:\n    LOGGER.error(\"Backup integration not available; skipping\")\n    return","preventionTips":["Call async_get_manager only after HOMEASSISTANT_STARTED or once the backup entry is loaded.","In tests, always set up the backup integration via the shared fixtures.","Check DATA_MANAGER in hass.data before calling if availability is uncertain."],"tags":["backup","home-assistant","setup-order","integration"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}