[Bug]: Bad epub causes crash with Unhandled rejection error #1888

Closed
opened 2026-04-25 00:00:59 +02:00 by adam · 8 comments
Owner

Originally created by @evilalmus on GitHub (Apr 16, 2024).

Describe the issue

Brand new install on Docker, I am probably doing something wrong. Install works, and it starts scanning my library, but it very quickly crashes. Below is the error included in the Crash Log:

[Server] Unhandled rejection: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received , promise: Promise {
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received
at Object.read (node:fs:673:11)
at FsRead.read (/server/libs/nodeStreamZip/index.js:979:10)
at FileWindowBuffer.read (/server/libs/nodeStreamZip/index.js:1023:86)
at readEntries (/server/libs/nodeStreamZip/index.js:319:12)
at Object.readCentralDirectoryComplete [as complete] (/server/libs/nodeStreamZip/index.js:252:9)
at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:192:14)
at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19)
at FSReqCallback.wrapper [as oncomplete] (node:fs:686:5) {
code: 'ERR_INVALID_ARG_VALUE'
}
}

Steps to reproduce the issue

  1. Launch Docker container, and point it at an existing library.

Audiobookshelf version

v2.8.1

How are you running audiobookshelf?

Docker

Originally created by @evilalmus on GitHub (Apr 16, 2024). ### Describe the issue Brand new install on Docker, I am probably doing something wrong. Install works, and it starts scanning my library, but it very quickly crashes. Below is the error included in the Crash Log: [Server] Unhandled rejection: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received <Buffer >, promise: Promise { <rejected> TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received <Buffer > at Object.read (node:fs:673:11) at FsRead.read (/server/libs/nodeStreamZip/index.js:979:10) at FileWindowBuffer.read (/server/libs/nodeStreamZip/index.js:1023:86) at readEntries (/server/libs/nodeStreamZip/index.js:319:12) at Object.readCentralDirectoryComplete [as complete] (/server/libs/nodeStreamZip/index.js:252:9) at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:192:14) at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19) at FSReqCallback.wrapper [as oncomplete] (node:fs:686:5) { code: 'ERR_INVALID_ARG_VALUE' } } ### Steps to reproduce the issue 1. Launch Docker container, and point it at an existing library. ### Audiobookshelf version v2.8.1 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-25 00:00:59 +02:00
adam closed this issue 2026-04-25 00:00:59 +02:00
Author
Owner

@evilalmus commented on GitHub (Apr 16, 2024):

Here are the WARN and ERROR Logs from right before the FATAL:

2024-04-16 12:39:18.685
WARN
Cover image not found in manifest for epub at "/audiobooks/Samantha Shannon/A_Day_of_Fallen_Night_-_Samantha_Shannon.epub"

2024-04-16 12:39:18.847
WARN
Cover image not found in manifest for epub at "/audiobooks/William Boyd/The Romantic - William Boyd.epub"

2024-04-16 12:39:21.037
WARN
Cover image not found in manifest for epub at "/audiobooks/Ernest Hemingway/Ernest Hemingway - Big Two-Hearted River.epub"

2024-04-16 12:39:21.308
ERROR
[xmlToJSON] Error Error: Unexpected close tag Line: 10 Column: 1461 Char: >

2024-04-16 12:39:27.173
ERROR
[parseEpubMetadata] Failed to extract META-INF/container.xml from epub at "/audiobooks/Dinesh D'Souza/Dinesh D'Souza - 2,000 Mules (2022).epub" TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received

2024-04-16 12:39:27.174
FATAL
[Server] Unhandled rejection: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received , promise: Promise { TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received at Object.read (node:fs:673:11) at FsRead.read (/server/libs/nodeStreamZip/index.js:979:10) at FileWindowBuffer.read (/server/libs/nodeStreamZip/index.js:1023:86) at readEntries (/server/libs/nodeStreamZip/index.js:319:12) at Object.readCentralDirectoryComplete [as complete] (/server/libs/nodeStreamZip/index.js:252:9) at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:192:14) at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19) at FSReqCallback.wrapper [as oncomplete] (node:fs:686:5) { code: 'ERR_INVALID_ARG_VALUE' } }

@evilalmus commented on GitHub (Apr 16, 2024): Here are the WARN and ERROR Logs from right before the FATAL: 2024-04-16 12:39:18.685 WARN Cover image not found in manifest for epub at "/audiobooks/Samantha Shannon/A_Day_of_Fallen_Night_-_Samantha_Shannon.epub" 2024-04-16 12:39:18.847 WARN Cover image not found in manifest for epub at "/audiobooks/William Boyd/The Romantic - William Boyd.epub" 2024-04-16 12:39:21.037 WARN Cover image not found in manifest for epub at "/audiobooks/Ernest Hemingway/Ernest Hemingway - Big Two-Hearted River.epub" 2024-04-16 12:39:21.308 ERROR [xmlToJSON] Error Error: Unexpected close tag Line: 10 Column: 1461 Char: > 2024-04-16 12:39:27.173 ERROR [parseEpubMetadata] Failed to extract META-INF/container.xml from epub at "/audiobooks/Dinesh D'Souza/Dinesh D'Souza - 2,000 Mules (2022).epub" TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received <Buffer > 2024-04-16 12:39:27.174 FATAL [Server] Unhandled rejection: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received <Buffer >, promise: Promise { <rejected> TypeError [ERR_INVALID_ARG_VALUE]: The argument 'buffer' is empty and cannot be written. Received <Buffer > at Object.read (node:fs:673:11) at FsRead.read (/server/libs/nodeStreamZip/index.js:979:10) at FileWindowBuffer.read (/server/libs/nodeStreamZip/index.js:1023:86) at readEntries (/server/libs/nodeStreamZip/index.js:319:12) at Object.readCentralDirectoryComplete [as complete] (/server/libs/nodeStreamZip/index.js:252:9) at FsRead.readUntilFoundCallback [as callback] (/server/libs/nodeStreamZip/index.js:192:14) at FsRead.readCallback (/server/libs/nodeStreamZip/index.js:996:19) at FSReqCallback.wrapper [as oncomplete] (node:fs:686:5) { code: 'ERR_INVALID_ARG_VALUE' } }
Author
Owner

@nichwall commented on GitHub (Apr 16, 2024):

Related to https://github.com/advplyr/audiobookshelf/issues/2750

Edit: Whoops, that issue is actually about CBR/CBZ. Someone mentioned getting this same error with epub but can't find where that was...

@nichwall commented on GitHub (Apr 16, 2024): Related to https://github.com/advplyr/audiobookshelf/issues/2750 Edit: Whoops, that issue is actually about CBR/CBZ. Someone mentioned getting this same error with epub but can't find where that was...
Author
Owner

@evilalmus commented on GitHub (Apr 16, 2024):

I was about to say, I don't have any CBR or CBZ files ;)

@evilalmus commented on GitHub (Apr 16, 2024): I was about to say, I don't have any CBR or CBZ files ;)
Author
Owner

@evilalmus commented on GitHub (Apr 16, 2024):

I did look for an existing issue before I opened this one

@evilalmus commented on GitHub (Apr 16, 2024): I did look for an existing issue before I opened this one
Author
Owner

@advplyr commented on GitHub (Apr 16, 2024):

Can you share the 2,000 Mules epub with me in a Discord DM or via email to dev@advplyr.com for testing?

@advplyr commented on GitHub (Apr 16, 2024): Can you share the 2,000 Mules epub with me in a Discord DM or via email to dev@advplyr.com for testing?
Author
Owner

@evilalmus commented on GitHub (Apr 16, 2024):

Can you share the 2,000 Mules epub with me in a Discord DM or via email to dev@advplyr.com for testing?

Sent via Discord DM

@evilalmus commented on GitHub (Apr 16, 2024): > Can you share the 2,000 Mules epub with me in a Discord DM or via email to [dev@advplyr.com](mailto:dev@advplyr.com) for testing? Sent via Discord DM
Author
Owner

@advplyr commented on GitHub (Apr 17, 2024):

This was a bad epub file but we should be catching the errors thrown by node stream zip library.

@advplyr commented on GitHub (Apr 17, 2024): This was a bad epub file but we should be catching the errors thrown by node stream zip library.
Author
Owner

@advplyr commented on GitHub (Apr 22, 2024):

Fixed in v2.9.0

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

No dependencies set.

Reference: starred/audiobookshelf#1888