[Bug]: Backup Causes ABS to exit with error 5 code: 'SQLITE_BUSY' (database is locked) #2937

Open
opened 2026-04-25 00:11:58 +02:00 by adam · 8 comments
Owner

Originally created by @LeeThompson on GitHub (Aug 10, 2025).

What happened?

I have ABS set to do backups at 2AM. Twice now I've found the docker container stopped in the morning with "Emitted 'error' event on Backup instance at: [Error: SQLITE_BUSY: database is locked "

There is one client connected to ABS, my android phone.

What did you expect to happen?

I would at least expect ABS's backup function to wait for the database to be unlocked instead of just throwing a fatal exception.

Steps to reproduce the issue

I'm not entirely sure, this has happened twice and both happened this week. I have ABS set to keep 5 backups.

Audiobookshelf version

v2.27.0

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Other (list in "Additional Notes" box)

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs

ABS Daily

{"timestamp":"2025-08-10 02:00:00.263","source":"ApiCacheManager.js:20","message":"[ApiCacheManager] Object.afterBulkUpdate: Clearing cache","levelName":"DEBUG","level":1}
{"timestamp":"2025-08-10 02:00:00.264","source":"PlaybackSessionManager.js:235","message":"[PlaybackSessionManager] Updating progress for \"Children of Memory\" with current time 3521.242 (previously 3506.243)","levelName":"INFO","level":2}
{"timestamp":"2025-08-10 02:00:00.529","source":"BackupManager.js:293","message":"[BackupManager] Running Backup","levelName":"INFO","level":2}
{"timestamp":"2025-08-10 02:00:01.270","source":"ApiCacheManager.js:20","message":"[ApiCacheManager] mediaProgress.afterUpdate: Clearing cache","levelName":"DEBUG","level":1}
{"timestamp":"2025-08-10 02:00:01.270","source":"MediaProgress.js:254","message":"[MediaProgress] Manually setting updatedAt to '2025-08-10 08:59:58.666 +00:00' (media item 88837b9f-0934-4b6d-8752-5b9f492ff8c6)","levelName":"INFO","level":2}
(exception)

Docker

[2025-08-10 02:00:00.529] INFO: [BackupManager] Running Backup 
[2025-08-10 02:00:01.269] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache 
[2025-08-10 02:00:01.270] INFO: [MediaProgress] Manually setting updatedAt to '2025-08-10 08:59:58.666 +00:00' (media item 88837b9f-0934-4b6d-8752-5b9f492ff8c6) 
[2025-08-10 02:00:01.702] FATAL: [Server] Uncaught exception origin: uncaughtException, error: [Error: SQLITE_BUSY: database is locked] { 
  errno: 5,
  code: 'SQLITE_BUSY'
}
<anonymous_script>:0 

[Error: SQLITE_BUSY: database is locked 
Emitted 'error' event on Backup instance at: 
] { 
  errno: 5,
  code: 'SQLITE_BUSY'
}

Node.js v20.19.4
(container stops)

Additional Notes

Running on a Synology (Debian fork)

Originally created by @LeeThompson on GitHub (Aug 10, 2025). ### What happened? I have ABS set to do backups at 2AM. Twice now I've found the docker container stopped in the morning with "Emitted 'error' event on Backup instance at: [Error: SQLITE_BUSY: database is locked " There is one client connected to ABS, my android phone. ### What did you expect to happen? I would at least expect ABS's backup function to wait for the database to be unlocked instead of just throwing a fatal exception. ### Steps to reproduce the issue I'm not entirely sure, this has happened twice and both happened this week. I have ABS set to keep 5 backups. ### Audiobookshelf version v2.27.0 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Other (list in "Additional Notes" box) ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs #### ABS Daily ```shell {"timestamp":"2025-08-10 02:00:00.263","source":"ApiCacheManager.js:20","message":"[ApiCacheManager] Object.afterBulkUpdate: Clearing cache","levelName":"DEBUG","level":1} {"timestamp":"2025-08-10 02:00:00.264","source":"PlaybackSessionManager.js:235","message":"[PlaybackSessionManager] Updating progress for \"Children of Memory\" with current time 3521.242 (previously 3506.243)","levelName":"INFO","level":2} {"timestamp":"2025-08-10 02:00:00.529","source":"BackupManager.js:293","message":"[BackupManager] Running Backup","levelName":"INFO","level":2} {"timestamp":"2025-08-10 02:00:01.270","source":"ApiCacheManager.js:20","message":"[ApiCacheManager] mediaProgress.afterUpdate: Clearing cache","levelName":"DEBUG","level":1} {"timestamp":"2025-08-10 02:00:01.270","source":"MediaProgress.js:254","message":"[MediaProgress] Manually setting updatedAt to '2025-08-10 08:59:58.666 +00:00' (media item 88837b9f-0934-4b6d-8752-5b9f492ff8c6)","levelName":"INFO","level":2} (exception) ``` #### Docker ```shell [2025-08-10 02:00:00.529] INFO: [BackupManager] Running Backup [2025-08-10 02:00:01.269] DEBUG: [ApiCacheManager] mediaProgress.afterUpdate: Clearing cache [2025-08-10 02:00:01.270] INFO: [MediaProgress] Manually setting updatedAt to '2025-08-10 08:59:58.666 +00:00' (media item 88837b9f-0934-4b6d-8752-5b9f492ff8c6) [2025-08-10 02:00:01.702] FATAL: [Server] Uncaught exception origin: uncaughtException, error: [Error: SQLITE_BUSY: database is locked] { errno: 5, code: 'SQLITE_BUSY' } <anonymous_script>:0 [Error: SQLITE_BUSY: database is locked Emitted 'error' event on Backup instance at: ] { errno: 5, code: 'SQLITE_BUSY' } Node.js v20.19.4 (container stops) ``` ### Additional Notes Running on a Synology (Debian fork)
adam added the bug label 2026-04-25 00:11:58 +02:00
Author
Owner

@Vito0912 commented on GitHub (Aug 10, 2025):

Is the SQLite file stored on a network drive or locally (from the server's point of view)?

@Vito0912 commented on GitHub (Aug 10, 2025): Is the SQLite file stored on a network drive or locally (from the server's point of view)?
Author
Owner

@LeeThompson commented on GitHub (Aug 10, 2025):

Is the SQLite file stored on a network drive or locally (from the server's point of view)?

Local. (Mounted to the host's volume for persistence).

My working theory is that it's just unfortunate timing that my client is updating position in the book right when the backup is trying to work with the database.

I've just changed the time of day for backups from 2AM to 3:30AM so I'm going to be less likely to be listening to a book when the backup starts.

@LeeThompson commented on GitHub (Aug 10, 2025): > Is the SQLite file stored on a network drive or locally (from the server's point of view)? Local. (Mounted to the host's volume for persistence). My working theory is that it's just unfortunate timing that my client is updating position in the book right when the backup is trying to work with the database. I've just changed the time of day for backups from 2AM to 3:30AM so I'm going to be less likely to be listening to a book when the backup starts.
Author
Owner

@wesf99 commented on GitHub (Dec 5, 2025):

Is the SQLite file stored on a network drive or locally (from the server's point of view)?

Local. (Mounted to the host's volume for persistence).

My working theory is that it's just unfortunate timing that my client is updating position in the book right when the backup is trying to work with the database.

I've just changed the time of day for backups from 2AM to 3:30AM so I'm going to be less likely to be listening to a book when the backup starts.

Did you get this error fixed. I've been getting this error once or twice per week. I have audiobookshelf running in docker on my synology nas. I have set it to run at 12pm every day.

@wesf99 commented on GitHub (Dec 5, 2025): > > Is the SQLite file stored on a network drive or locally (from the server's point of view)? > > Local. (Mounted to the host's volume for persistence). > > My working theory is that it's just unfortunate timing that my client is updating position in the book right when the backup is trying to work with the database. > > I've just changed the time of day for backups from 2AM to 3:30AM so I'm going to be less likely to be listening to a book when the backup starts. Did you get this error fixed. I've been getting this error once or twice per week. I have audiobookshelf running in docker on my synology nas. I have set it to run at 12pm every day.
Author
Owner

@LeeThompson commented on GitHub (Dec 7, 2025):

Did you get this error fixed. I've been getting this error once or twice per week. I have audiobookshelf running in docker on my synology nas. I have set it to run at 12pm every day.

I moved my backup time for ABS to 3:30AM and haven't tripped it but it would be nice if ABS had a better way of handling this.

@LeeThompson commented on GitHub (Dec 7, 2025): > Did you get this error fixed. I've been getting this error once or twice per week. I have audiobookshelf running in docker on my synology nas. I have set it to run at 12pm every day. I moved my backup time for ABS to 3:30AM and haven't tripped it but it would be nice if ABS had a better way of handling this.
Author
Owner

@wesf99 commented on GitHub (Dec 7, 2025):

Did you get this error fixed. I've been getting this error once or twice per week. I have audiobookshelf running in docker on my synology nas. I have set it to run at 12pm every day.

I moved my backup time for ABS to 3:30AM and haven't tripped it but it would be nice if ABS had a better way of handling this.

I've moved mine for ward to 5am. Hopefully, that will work. Thank you.

@wesf99 commented on GitHub (Dec 7, 2025): > > Did you get this error fixed. I've been getting this error once or twice per week. I have audiobookshelf running in docker on my synology nas. I have set it to run at 12pm every day. > > I moved my backup time for ABS to 3:30AM and haven't tripped it but it would be nice if ABS had a better way of handling this. I've moved mine for ward to 5am. Hopefully, that will work. Thank you.
Author
Owner

@DrLeh commented on GitHub (Jan 17, 2026):

I get this same error on startup, i have my sqlite db in a NAS mounted folder. Should i move it to be local?

EDIT: moving configs to local folder solved my issue but is not ideal

@DrLeh commented on GitHub (Jan 17, 2026): I get this same error on startup, i have my sqlite db in a NAS mounted folder. Should i move it to be local? EDIT: moving configs to local folder solved my issue but is not ideal
Author
Owner

@wesf99 commented on GitHub (Jan 17, 2026):

I get this same error on startup, i have my sqlite db in a NAS mounted folder. Should i move it to be local?

EDIT: moving configs to local folder solved my issue but is not ideal

I resolved the problem for me by installing autoheal: https://github.com/willfarrell/docker-autoheal

@wesf99 commented on GitHub (Jan 17, 2026): > I get this same error on startup, i have my sqlite db in a NAS mounted folder. Should i move it to be local? > > EDIT: moving configs to local folder solved my issue but is not ideal I resolved the problem for me by installing autoheal: https://github.com/willfarrell/docker-autoheal
Author
Owner

@nichwall commented on GitHub (Jan 19, 2026):

I get this same error on startup, i have my sqlite db in a NAS mounted folder. Should i move it to be local?

EDIT: moving configs to local folder solved my issue but is not ideal

The SQLite must be stored on the same device and not mounted over the network as mentioned in the documentation. https://www.audiobookshelf.org/docs#docker-compose-install

https://sqlite.org/useovernet.html

@nichwall commented on GitHub (Jan 19, 2026): > I get this same error on startup, i have my sqlite db in a NAS mounted folder. Should i move it to be local? > > EDIT: moving configs to local folder solved my issue but is not ideal The SQLite must be stored on the same device and not mounted over the network as mentioned in the documentation. https://www.audiobookshelf.org/docs#docker-compose-install https://sqlite.org/useovernet.html
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2937