Unable to create scheduled backup - trigger manually is fine

I am trying to knock down some persistent errors I have and this is one that’s plagued me. I’ve seen lots of other reports but no good resolution or even deeper troubleshooting steps.

I’m running HA in an HAOS VM on my Synology NAS. It’s running fine, mostly, no high CPU or storage usage. I configured automatic backups for once per week, Sunday mornings at 4:45 AM. My thought being it’s an intensive operation and nothing is going on and nobody is going to ask HA to do anything at that time. I backup all the configuration and history as well as the add-ons. HA estimates the size at ~9GB, through the tarball is smaller by a lot. I have it configured to store on my Synology NAS as well as Microsoft OneDrive, so a total of three locations.

This worked well when configured last summer. Then, in the fall, I started having a problem where the scheduled automatic backups always failed but manually triggering an automatic backup would succeed. I then had a separate problem where HA could do backups but all uploads (Synology and OneDrive) failed with no obvious error. I wanted to resolve this before cracking on with the other issues. The upload issues resolved when I installed the Feb .2 core update, so that part is now good. If I manually trigger an automatic backup it works and uploads to all configured locations.

But a scheduled backup always fails. The core log has the following:

Logger: homeassistant.components.backup
Source: components/backup/config.py:571
integration: Backup (documentation, issues)
First occurred: 4:45:43 AM (1 occurrence)
Last logged: 4:45:43 AM

Error creating backup: Backup failed: [{‘type’: ‘HomeAssistantBackupError’, ‘message’: “Preparing backup of Home Assistant Core failed. Failed to inform HA Core: Unsuccessful websocket message - {‘id’: 673, ‘type’: ‘result’, ‘success’: False, ‘error’: {‘code’: ‘pre_backup_actions_failed’, ‘message’: ‘Error during pre-backup: Could not lock database within 30 seconds.’}}.”, ‘stage’: ‘home_assistant’, ‘error_key’: None, ‘extra_fields’: None}]

The supervisor log has this:

2026-02-15 04:45:01.149 INFO (MainThread) [supervisor.backups.manager] Backup c9b57410 starting stage addon_repositories
2026-02-15 04:45:01.156 INFO (MainThread) [supervisor.backups.manager] Creating new partial backup with slug c9b57410
2026-02-15 04:45:01.310 INFO (MainThread) [supervisor.backups.manager] Backup c9b57410 starting stage home_assistant
2026-02-15 04:45:42.324 ERROR (MainThread) [supervisor.homeassistant.module] Preparing backup of Home Assistant Core failed. Failed to inform HA Core: Unsuccessful websocket message - {‘id’: 673, ‘type’: ‘result’, ‘success’: False, ‘error’: {‘code’: ‘pre_backup_actions_failed’, ‘message’: ‘Error during pre-backup: Could not lock database within 30 seconds.’}}.
2026-02-15 04:45:42.948 ERROR (MainThread) [supervisor.backups.manager] Backup c9b57410 error: Preparing backup of Home Assistant Core failed. Failed to inform HA Core: Unsuccessful websocket message - {‘id’: 673, ‘type’: ‘result’, ‘success’: False, ‘error’: {‘code’: ‘pre_backup_actions_failed’, ‘message’: ‘Error during pre-backup: Could not lock database within 30 seconds.’}}.

I’d like to troubleshoot this but I’m not sure where to go next. Is there any logging that can shed light on the locking issue on the database? Or is there any check of the database file that would help here?

I’d appreciate any next steps.

Database housekeeping occurs around that time (4:12am) and may not be completed when your backup starts.
The lock message may be the clue.

Are you able to see when the housekeeping starts, completes and the backup starts?

Is your database integrity suspect? How big is it? Compared to total free storage space? On the storage destinations too? Has is bloated unexpectedly? Have you changed any recorder parameters lately?

First troubleshooting action: Try moving the backup schedule to later on Sunday morning and see if reduces the problem. Maybe change it to tomorrow morning 6:00am for problem isolation purposes. [That won’t fix the underlying problem, just help isolate it.]

Just ideas…

1 Like

I didn’t know about the database maintenance. I’ll schedule one for 6AM tomorrow morning and see how it goes. Thanks.

I scheduled for 6:00 AM today and it ran fine. I’ll see how this goes over the next couple of weeks but perhaps it was just the maintenance that was conflicting.

Sounds good. Go back to my previous post and confirm if you have other lurking unresolved issues that may rear their ugly head at a future date if not addressed.

There do not seem to be. I have a pretty large Zigbee issue I’m chasing, but that’s not at all related and is a subject for another thread. The backups are working fine right now.

They may be related in that your ZigBee issues are bloating the database that is then having problems with maintenance and backup. Best wishes in your path to a slick, well functioning system.