home-assistant/core · error · BackupManagerError

Error during pre-backup: {result}

Error message

Error during pre-backup: {result}

What it means

Raised by BackupManager.async_pre_backup_actions when any registered backup platform's async_pre_backup(hass) coroutine raises. The platforms run concurrently with return_exceptions=True; the first Exception found is re-raised wrapped in BackupManagerError with the original as __cause__. It fires before a backup starts, so platforms (e.g., recorder, MariaDB/MySQL integrations) failed their pre-backup preparation (such as pausing writes or flushing).

Source

Thrown at homeassistant/components/backup/manager.py:512

        LOGGER.debug("%s platforms loaded in total", len(self.platforms))
        LOGGER.debug("%s agents loaded in total", len(self.backup_agents))
        LOGGER.debug("%s local agents loaded in total", len(self.local_backup_agents))
        event = BackupPlatformEvent(domain=integration_domain)
        for subscription in self._backup_platform_event_subscriptions:
            subscription(event)

    async def async_pre_backup_actions(self) -> None:
        """Perform pre backup actions."""
        pre_backup_results = await asyncio.gather(
            *(
                platform.async_pre_backup(self.hass)
                for platform in self.platforms.values()
            ),
            return_exceptions=True,
        )
        for result in pre_backup_results:
            if isinstance(result, Exception):
                raise BackupManagerError(
                    f"Error during pre-backup: {result}"
                ) from result

    async def async_post_backup_actions(self) -> None:
        """Perform post backup actions."""
        post_backup_results = await asyncio.gather(
            *(
                platform.async_post_backup(self.hass)
                for platform in self.platforms.values()
            ),
            return_exceptions=True,
        )
        for result in post_backup_results:
            if isinstance(result, Exception):
                raise BackupManagerError(
                    f"Error during post-backup: {result}"
                ) from result

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Read the wrapped message — it embeds the underlying platform error (f"Error during pre-backup: {result}") which names the real failure.
  2. Check recorder/database health (repair or vacuum the recorder database, verify MariaDB connectivity) and disk space.
  3. Update or fix the integration whose platform raised; disable it temporarily to confirm it is the source.
  4. Retry the backup once transient DB/network issues are resolved.
Defensive patterns

Strategy: try-catch

Try / catch

from homeassistant.components.backup.manager import BackupManagerError

try:
    await manager.async_pre_backup_actions()
except BackupManagerError as err:
    LOGGER.error("pre-backup failed: %s (cause: %s)", err, err.__cause__)
    abort_backup()

Prevention

When it happens

Trigger: Starting a backup (async_create_backup) while a pre-backup hook fails — recorder failing to pause/lock the database, a database integration timing out, an addon platform raising, or any custom integration implementing the backup platform incorrectly.

Common situations: Recorder on a struggling database (large SQLite file, locked MariaDB); third-party integrations with buggy async_pre_backup; backups failing consistently at 'pre-backup' stage on slow disks.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/dbb3d85ff38612b8. Report an issue: GitHub.