[Bug]: Server crash on permission denied when extracting from EPUB file #2522

Closed
opened 2026-04-25 00:08:00 +02:00 by adam · 1 comment
Owner

Originally created by @valdearg on GitHub (Jan 24, 2025).

What happened?

When triggering a library re-scan, if the container does not have the correct permissions to the folder directly, the error crashes the server.

[2025-01-24 11:25:54.596] DEBUG: [FfmpegHelpers] Extract Cover Cmd: ffmpeg -i /ln_audiobooks/Toradora!/Toradora!, Vol. 04/Toradora! v04 [Seven Seas Siren] [Stick].m4b -y -map 0:v:0 -frames:v 1 /ln_audiobooks/Toradora!/Toradora!, Vol. 04/cover.jpg
[2025-01-24 11:25:54.918] ERROR: [FfmpegHelpers] Extract Cover Error Error: ffmpeg exited with code 251: frame=    1 fps=0.0 q=10.1 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
Conversion failed!
[2025-01-24 11:25:54.946] ERROR: [parseEpubMetadata] Failed to extract image OEBPS/Images/CoverDesign.jpg from epub at "/ln_audiobooks/Toradora!/Toradora!, Vol. 04/Toradora! v04 [Seven Seas] [Stick].epub" [Error: EACCES: permission denied, open '/ln_audiobooks/Toradora!/Toradora!, Vol. 04/cover.jpg'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/ln_audiobooks/Toradora!/Toradora!, Vol. 04/cover.jpg'
}
[2025-01-24 11:25:54.966] FATAL: [Server] Uncaught exception origin: uncaughtException, error: [Error: EBADF: bad file descriptor, read] {
  errno: -9,
  code: 'EBADF',
  syscall: 'read'
}
node:events:496
      throw er; // Unhandled 'error' event
      ^
Error: EBADF: bad file descriptor, read
Emitted 'error' event on EntryDataReaderStream instance at:
    at EntryDataReaderStream.readCallback (/server/libs/nodeStreamZip/index.js:1091:12)
    at FSReqCallback.wrapper [as oncomplete] (node:fs:682:5) {
  errno: -9,
  code: 'EBADF',
  syscall: 'read'
}

The error is correct in that the permissions hadn't replicated over, but could this be handled better by the system?

What did you expect to happen?

Log an error and then continue scanning.

Steps to reproduce the issue

  1. Setup a dir where the user running the container has read permissions but no write permissions, have the system store the cover and JSON in the same dir as the audiobook.
  2. Scan the audiobook where there is an epub file alongside.
  3. Scan seems to crash at this stage.

Audiobookshelf version

v2.18.1

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

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

None

Logs


Additional Notes

No response

Originally created by @valdearg on GitHub (Jan 24, 2025). ### What happened? When triggering a library re-scan, if the container does not have the correct permissions to the folder directly, the error crashes the server. ``` [2025-01-24 11:25:54.596] DEBUG: [FfmpegHelpers] Extract Cover Cmd: ffmpeg -i /ln_audiobooks/Toradora!/Toradora!, Vol. 04/Toradora! v04 [Seven Seas Siren] [Stick].m4b -y -map 0:v:0 -frames:v 1 /ln_audiobooks/Toradora!/Toradora!, Vol. 04/cover.jpg [2025-01-24 11:25:54.918] ERROR: [FfmpegHelpers] Extract Cover Error Error: ffmpeg exited with code 251: frame= 1 fps=0.0 q=10.1 Lsize=N/A time=00:00:00.00 bitrate=N/A speed= 0x Conversion failed! [2025-01-24 11:25:54.946] ERROR: [parseEpubMetadata] Failed to extract image OEBPS/Images/CoverDesign.jpg from epub at "/ln_audiobooks/Toradora!/Toradora!, Vol. 04/Toradora! v04 [Seven Seas] [Stick].epub" [Error: EACCES: permission denied, open '/ln_audiobooks/Toradora!/Toradora!, Vol. 04/cover.jpg'] { errno: -13, code: 'EACCES', syscall: 'open', path: '/ln_audiobooks/Toradora!/Toradora!, Vol. 04/cover.jpg' } [2025-01-24 11:25:54.966] FATAL: [Server] Uncaught exception origin: uncaughtException, error: [Error: EBADF: bad file descriptor, read] { errno: -9, code: 'EBADF', syscall: 'read' } node:events:496 throw er; // Unhandled 'error' event ^ Error: EBADF: bad file descriptor, read Emitted 'error' event on EntryDataReaderStream instance at: at EntryDataReaderStream.readCallback (/server/libs/nodeStreamZip/index.js:1091:12) at FSReqCallback.wrapper [as oncomplete] (node:fs:682:5) { errno: -9, code: 'EBADF', syscall: 'read' } ``` The error is correct in that the permissions hadn't replicated over, but could this be handled better by the system? ### What did you expect to happen? Log an error and then continue scanning. ### Steps to reproduce the issue 1. Setup a dir where the user running the container has read permissions but no write permissions, have the system store the cover and JSON in the same dir as the audiobook. 2. Scan the audiobook where there is an epub file alongside. 3. Scan seems to crash at this stage. ### Audiobookshelf version v2.18.1 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:08:00 +02:00
adam closed this issue 2026-04-25 00:08:00 +02:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2025):

Fixed in v2.19.0.

@github-actions[bot] commented on GitHub (Feb 2, 2025): Fixed in [v2.19.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.19.0).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2522