[Bug]: a single "bad archive" anywhere in backups folder unregisters all backups (bad or good) #1283

Closed
opened 2026-04-24 23:38:22 +02:00 by adam · 5 comments
Owner

Originally created by @wtanksleyjr on GitHub (Jul 25, 2023).

Describe the issue

Backups will always deleted on next reboot with "Bad archive" error. See message below.

Steps to reproduce the issue

  1. I don't know how I got in this situation, so I can't give any steps. But here's the error message I get on every restart if a backup was made, or anytime I try to do anything with an existing backup.
  2. This happens with all backups, whether automatic or manually triggered.
  3. I knew this was happening as of my previous version installed (I think it was the last released version of 2.2.x, but I'm not absolutely sure). So it's not a new bug.
audiobookshelf_1  | [2023-07-24 23:25:29] INFO: [Database] Db data loaded in 16.84s
audiobookshelf_1  | [2023-07-24 23:25:30] ERROR: [BackupManager] Failed to unzip backup "/metadata/backups/2022-08-03T0130.audiobookshelf" Error: Bad archive
audiobookshelf_1  |     at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33)
audiobookshelf_1  |     at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19)
audiobookshelf_1  |     at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:174)
audiobookshelf_1  | [2023-07-24 23:25:30] ERROR: [BackupManager] Failed to load backups Error: Bad archive
audiobookshelf_1  |     at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33)
audiobookshelf_1  |     at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19)
audiobookshelf_1  |     at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:203)

Audiobookshelf version

2.3.3

How are you running audiobookshelf?

Docker

Originally created by @wtanksleyjr on GitHub (Jul 25, 2023). ### Describe the issue Backups will always deleted on next reboot with "Bad archive" error. See message below. ### Steps to reproduce the issue 1. I don't know how I got in this situation, so I can't give any steps. But here's the error message I get on every restart if a backup was made, or anytime I try to do anything with an existing backup. 2. This happens with all backups, whether automatic or manually triggered. 3. I knew this was happening as of my previous version installed (I think it was the last released version of 2.2.x, but I'm not absolutely sure). So it's not a new bug. ``` audiobookshelf_1 | [2023-07-24 23:25:29] INFO: [Database] Db data loaded in 16.84s audiobookshelf_1 | [2023-07-24 23:25:30] ERROR: [BackupManager] Failed to unzip backup "/metadata/backups/2022-08-03T0130.audiobookshelf" Error: Bad archive audiobookshelf_1 | at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33) audiobookshelf_1 | at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19) audiobookshelf_1 | at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:174) audiobookshelf_1 | [2023-07-24 23:25:30] ERROR: [BackupManager] Failed to load backups Error: Bad archive audiobookshelf_1 | at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33) audiobookshelf_1 | at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19) audiobookshelf_1 | at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:203) ``` ### Audiobookshelf version 2.3.3 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:38:22 +02:00
adam closed this issue 2026-04-24 23:38:22 +02:00
Author
Owner

@advplyr commented on GitHub (Jul 26, 2023):

The error you are showing is a backup from 2022-08-03. Is this error still happening on backups created with v2.3.3?

You can test if you can extract that backup file yourself

@advplyr commented on GitHub (Jul 26, 2023): The error you are showing is a backup from 2022-08-03. Is this error still happening on backups created with v2.3.3? You can test if you can extract that backup file yourself
Author
Owner

@wtanksleyjr commented on GitHub (Jul 28, 2023):

Wow, that's odd, I manually created that backup just that day. Let me check again (of course the backup file is always deleted when it's detected as bad).

@wtanksleyjr commented on GitHub (Jul 28, 2023): Wow, that's odd, I manually created that backup just that day. Let me check again (of course the backup file is always deleted when it's detected as bad).
Author
Owner

@wtanksleyjr commented on GitHub (Jul 28, 2023):

OK, so after confirming there were a reasonable number of automatic backups (3), all produced at 1:30AM on each day. I restarted the docker-compose service. Once it came up it said this:

audiobookshelf_1  | [2023-07-28 01:07:09] INFO: [Database] Db data loaded in 17.43s
audiobookshelf_1  | [2023-07-28 01:07:09] ERROR: [BackupManager] Failed to unzip backup "/metadata/backups/2022-08-03T0130.audiobookshelf" Error: Bad archive
audiobookshelf_1  |     at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33)
audiobookshelf_1  |     at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19)
audiobookshelf_1  |     at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:174)
audiobookshelf_1  | [2023-07-28 01:07:09] ERROR: [BackupManager] Failed to load backups Error: Bad archive
audiobookshelf_1  |     at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33)
audiobookshelf_1  |     at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19)
audiobookshelf_1  |     at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:203)

Now all three are gone, and there's nothing in the log that might pertain to all three being checked - only that one record.

I'll send this and then create a backup archive followed by manually unzipping it.

@wtanksleyjr commented on GitHub (Jul 28, 2023): OK, so after confirming there were a reasonable number of automatic backups (3), all produced at 1:30AM on each day. I restarted the docker-compose service. Once it came up it said this: ``` audiobookshelf_1 | [2023-07-28 01:07:09] INFO: [Database] Db data loaded in 17.43s audiobookshelf_1 | [2023-07-28 01:07:09] ERROR: [BackupManager] Failed to unzip backup "/metadata/backups/2022-08-03T0130.audiobookshelf" Error: Bad archive audiobookshelf_1 | at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33) audiobookshelf_1 | at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19) audiobookshelf_1 | at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:174) audiobookshelf_1 | [2023-07-28 01:07:09] ERROR: [BackupManager] Failed to load backups Error: Bad archive audiobookshelf_1 | at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:198:33) audiobookshelf_1 | at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19) audiobookshelf_1 | at FSReqCallback.wrapper [as oncomplete] (node:fs:671:5) (BackupManager.js:203) ``` Now all three are gone, and there's nothing in the log that might pertain to all three being checked - only that one record. I'll send this and then create a backup archive followed by manually unzipping it.
Author
Owner

@wtanksleyjr commented on GitHub (Jul 28, 2023):

OK, this was very simple. ABS wasn't deleting anything at all; what it was doing is finding one bad archive from a long time ago (as you see), and for some reason responding to that by removing all of my backups from its list. Then next time it restarted, it'd do the same thing.

The result is that my backups folder was absolutely stuffed with backups, what seemed like hundreds of them. I trimmed them down and reloaded them into the list so that hopefully it'll manage them per the configuration (I expected it only to keep 5).

If there's a bug here, it might be removing all backups from its list when any invalid backup is found. Aside from that, workaround is simple, all of the backups are right where they should be so can be loaded into the list manually.

@wtanksleyjr commented on GitHub (Jul 28, 2023): OK, this was very simple. ABS wasn't deleting anything at all; what it was doing is finding one bad archive from a long time ago (as you see), and for some reason responding to that by removing all of my backups from its list. Then next time it restarted, it'd do the same thing. The result is that my backups folder was absolutely stuffed with backups, what seemed like hundreds of them. I trimmed them down and reloaded them into the list so that hopefully it'll manage them per the configuration (I expected it only to keep 5). If there's a bug here, it might be removing all backups from its list when any invalid backup is found. Aside from that, workaround is simple, all of the backups are right where they should be so can be loaded into the list manually.
Author
Owner

@advplyr commented on GitHub (Oct 1, 2023):

Fixed in v2.4.4

@advplyr commented on GitHub (Oct 1, 2023): Fixed in [v2.4.4](https://github.com/advplyr/audiobookshelf/releases/tag/v2.4.4)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1283