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
- Read the wrapped message — it embeds the underlying platform error (f"Error during pre-backup: {result}") which names the real failure.
- Check recorder/database health (repair or vacuum the recorder database, verify MariaDB connectivity) and disk space.
- Update or fix the integration whose platform raised; disable it temporarily to confirm it is the source.
- 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
- Keep recorder database healthy (vacuum/repair) before scheduled backups.
- Watch the __cause__ of the wrapped error to find the guilty platform.
- Fix or disable misbehaving backup platforms before scheduling backups.
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
- Error during post-backup: {result}
- You need at least Home Assistant version {backup_meta_versio
- Failed during {func.__name__}
- Failed to upload backup
- Backup {backup_id} not found
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/dbb3d85ff38612b8.
Report an issue: GitHub.