[Bug]: Watcher fails to add single audio file to library if library is audiobooks-only #1507

Closed
opened 2026-04-24 23:48:02 +02:00 by adam · 1 comment
Owner

Originally created by @mikiher on GitHub (Nov 4, 2023).

Describe the issue

When adding a single audio file to the library's root folder, watcher detects the change but fails to add the book.

Relevant log lines:

[2023-11-04 10:29:00] DEBUG: [Watcher] File Added /torrents/2BR02B - librivox.m4b (Watcher.js:151)
[2023-11-04 10:29:00] DEBUG: [Watcher] Modified file in library "Torrents" and folder "7574feec-eebc-4858-a01e-7613f1eac121" with relPath "/2BR02B - librivox.m4b" (Watcher.js:256)
[2023-11-04 10:29:00] DEBUG: [Watcher] Waiting to add file at "/torrents/2BR02B - librivox.m4b". mtimeMs=1696863726581.3113 lastMTimeMs=0 (loop 0) (Watcher.js:209)
[2023-11-04 10:29:01] DEBUG: [Watcher] File finished adding at "/torrents/2BR02B - librivox.m4b" (Watcher.js:205)
[2023-11-04 10:29:04] DEBUG: [Scanner] Scanning file update groups in folder "7574feec-eebc-4858-a01e-7613f1eac121" of library "Torrents" (LibraryScanner.js:459)
[2023-11-04 10:29:04] DEBUG: [Scanner] scanFolderUpdates fileUpdateGroup { '2BR02B - librivox.m4b': '2BR02B - librivox.m4b' } (LibraryScanner.js:460)
[2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder update for relative path "2BR02B - librivox.m4b" has no audio files (LibraryScanner.js:563)
[2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder scan results {} (LibraryScanner.js:386)

Note that this line is unexpected:

[2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder update for relative path "2BR02B - librivox.m4b" has no audio files (LibraryScanner.js:563)

Steps to reproduce the issue

  1. Add an audio file to the an audiobooks-only library root folder.

Expected: New book is added to library.
Actual: New book not added to library.

Audiobookshelf version

v2.5.0

How are you running audiobookshelf?

Docker

Originally created by @mikiher on GitHub (Nov 4, 2023). ### Describe the issue When adding a single audio file to the library's root folder, watcher detects the change but fails to add the book. Relevant log lines: ``` [2023-11-04 10:29:00] DEBUG: [Watcher] File Added /torrents/2BR02B - librivox.m4b (Watcher.js:151) [2023-11-04 10:29:00] DEBUG: [Watcher] Modified file in library "Torrents" and folder "7574feec-eebc-4858-a01e-7613f1eac121" with relPath "/2BR02B - librivox.m4b" (Watcher.js:256) [2023-11-04 10:29:00] DEBUG: [Watcher] Waiting to add file at "/torrents/2BR02B - librivox.m4b". mtimeMs=1696863726581.3113 lastMTimeMs=0 (loop 0) (Watcher.js:209) [2023-11-04 10:29:01] DEBUG: [Watcher] File finished adding at "/torrents/2BR02B - librivox.m4b" (Watcher.js:205) [2023-11-04 10:29:04] DEBUG: [Scanner] Scanning file update groups in folder "7574feec-eebc-4858-a01e-7613f1eac121" of library "Torrents" (LibraryScanner.js:459) [2023-11-04 10:29:04] DEBUG: [Scanner] scanFolderUpdates fileUpdateGroup { '2BR02B - librivox.m4b': '2BR02B - librivox.m4b' } (LibraryScanner.js:460) [2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder update for relative path "2BR02B - librivox.m4b" has no audio files (LibraryScanner.js:563) [2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder scan results {} (LibraryScanner.js:386) ``` Note that this line is unexpected: ``` [2023-11-04 10:29:05] DEBUG: [LibraryScanner] Folder update for relative path "2BR02B - librivox.m4b" has no audio files (LibraryScanner.js:563) ``` ### Steps to reproduce the issue 1. Add an audio file to the an audiobooks-only library root folder. 2. Expected: New book is added to library. Actual: New book not added to library. ### Audiobookshelf version v2.5.0 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:48:02 +02:00
adam closed this issue 2026-04-24 23:48:03 +02:00
Author
Owner

@mikiher commented on GitHub (Nov 4, 2023):

The issue is due to this line in libraryScanner.js:

} else if (library.settings.audiobooksOnly && !fileUpdateGroup[itemDir].some?.(scanUtils.checkFilepathIsAudioFile)) {

For single items added to the root folder, fileUpdateGroup[itemDir] is not an array, and does not have a some method, so this condition evaluates to true (this issue is a side effect of this commit)

I'm on it...

@mikiher commented on GitHub (Nov 4, 2023): The issue is due to this line in libraryScanner.js: ``` } else if (library.settings.audiobooksOnly && !fileUpdateGroup[itemDir].some?.(scanUtils.checkFilepathIsAudioFile)) { ``` For single items added to the root folder, fileUpdateGroup[itemDir] is not an array, and does not have a some method, so this condition evaluates to true (this issue is a side effect of [this commit](https://github.com/advplyr/audiobookshelf/commit/a38e43213d0126846c56d0bc9644b181727f563e)) I'm on it...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1507