[Bug]: Single file Book re-added to library after deletion from file system #2870

Closed
opened 2026-04-25 00:11:24 +02:00 by adam · 4 comments
Owner

Originally created by @FiendFEARing on GitHub (Jul 5, 2025).

What happened?

After deleting a book from the ABS system, the library incorrectly re-added a blank entry with only the book name. All metadata fields were empty, and the book could not be opened because the file no longer existed.

Image Image Image

What did you expect to happen?

The "Automatically Scan Library" function should not add permanently removed book name back to the library.

Steps to reproduce the issue

  1. Enable "Automatically scan library for changes" in a test Book library.
  2. Delete a book from this library with the "Delete from file system" option checked.
  3. After deletion, a "Scanning file changes" task is triggered as expected.
  4. Once the task completes, the deleted book is unexpectedly re-added to the library, even though the original file has already been removed from the file system.

Audiobookshelf version

v2.25.1

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

macOS

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

None

Logs


Originally created by @FiendFEARing on GitHub (Jul 5, 2025). ### What happened? After deleting a book from the ABS system, the library incorrectly re-added a blank entry with only the book name. All metadata fields were empty, and the book could not be opened because the file no longer existed. <img width="530" height="282" alt="Image" src="https://github.com/user-attachments/assets/d539620e-6dab-47ed-9a99-ec443612af5e" /> <img width="809" height="703" alt="Image" src="https://github.com/user-attachments/assets/b6625488-abde-468f-83a3-3b27cb011110" /> <img width="803" height="222" alt="Image" src="https://github.com/user-attachments/assets/31dcd6a7-fb38-47f6-b922-52db2f97edc5" /> ### What did you expect to happen? The "Automatically Scan Library" function should not add permanently removed book name back to the library. ### Steps to reproduce the issue 1. Enable **"Automatically scan library for changes"** in a test **Book** library. 2. Delete a book from this library with the **"Delete from file system"** option checked. 3. After deletion, a **"Scanning file changes"** task is triggered as expected. 4. Once the task completes, the deleted book is unexpectedly re-added to the library, even though the original file has already been removed from the file system. ### Audiobookshelf version v2.25.1 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? macOS ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell ```
adam added the bug label 2026-04-25 00:11:24 +02:00
adam closed this issue 2026-04-25 00:11:24 +02:00
Author
Owner

@advplyr commented on GitHub (Jul 9, 2025):

Can you provide logs for this? The logs show step by step what the scanner is doing.

@advplyr commented on GitHub (Jul 9, 2025): Can you provide logs for this? The logs show step by step what the scanner is doing.
Author
Owner

@FiendFEARing commented on GitHub (Jul 9, 2025):

Can you provide logs for this? The logs show step by step what the scanner is doing.

2025-07-09 10:55:15.427 DEBUG [ApiCacheManager] Caching with 1800000 ms TTL
2025-07-09 10:55:29.039 DEBUG [ApiCacheManager] Object.afterBulkDestroy: Clearing cache
2025-07-09 10:55:29.052 DEBUG [CacheManager] Going to purge bda83e5b-b3f8-42f4-8ab1-b553a42d6557_400.webp
2025-07-09 10:55:29.053 INFO [ApiRouter] Removing item metadata at "/metadata/items/bda83e5b-b3f8-42f4-8ab1-b553a42d6557"
2025-07-09 10:55:29.063 DEBUG [ApiCacheManager] libraryItem.afterDestroy: Clearing cache
2025-07-09 10:55:29.063 DEBUG [ApiCacheManager] Object.afterBulkDestroy: Clearing cache
2025-07-09 10:55:29.063 INFO [LibraryItemController] Deleting library item from file system at "/audiobooks/图书/test_book.epub"
2025-07-09 10:55:29.068 DEBUG [LibraryItemsBookFilters] book.afterDestroy: Clearing count cache
2025-07-09 10:55:29.068 DEBUG [ApiCacheManager] book.afterDestroy: Clearing cache
2025-07-09 10:55:31.407 DEBUG [Watcher] File Removed /audiobooks/图书/test_book.epub
2025-07-09 10:55:31.408 DEBUG [Watcher] Modified file in library "图书" and folder "4dec5e60-50bd-4d47-93d3-51e867111e1c" with relPath "/test_book.epub"
2025-07-09 10:55:41.414 DEBUG [Scanner] Scanning file update groups in folder "4dec5e60-50bd-4d47-93d3-51e867111e1c" of library "图书"
2025-07-09 10:55:41.415 DEBUG [Scanner] scanFolderUpdates fileUpdateGroup { 'test_book.epub': 'test_book.epub' }
2025-07-09 10:55:41.417 ERROR [Utils] Failed to get ino for path /audiobooks/图书/test_book.epub [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' }
2025-07-09 10:55:41.417 ERROR [Utils] Failed to get ino for path /audiobooks/图书/test_book.epub [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' }
2025-07-09 10:55:41.418 DEBUG [LibraryScanner] Folder update group must be a new item "test_book.epub" in library "图书"
2025-07-09 10:55:41.419 ERROR [fileUtils] Failed to getFileTimestampsWithIno for path "/audiobooks/图书/test_book.epub" [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' }
2025-07-09 10:55:41.419 ERROR [fileUtils] Failed to getFileTimestampsWithIno for path "/audiobooks/图书/test_book.epub" [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' }
2025-07-09 10:55:41.419 DEBUG Parsing metadata from epub at "/audiobooks/图书/test_book.epub"
2025-07-09 10:55:41.419 ERROR [parseEpubMetadata] Failed to extract META-INF/container.xml from epub at "/audiobooks/图书/test_book.epub" [Error: ENOENT: no such file or directory, open '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'open', path: '/audiobooks/图书/test_book.epub' }
2025-07-09 10:55:41.419 ERROR [parseEpubMetadata] Failed to close zip [Error: ENOENT: no such file or directory, open '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'open', path: '/audiobooks/图书/test_book.epub' }
2025-07-09 10:55:41.420 DEBUG [Scan] "test_book.epub": "test_book" Getting metadata with precedence [folderStructure, audioMetatags, nfoFile, txtFiles, opfFile, absMetadata]
2025-07-09 10:55:41.423 DEBUG [LibraryItemsBookFilters] book.afterCreate: Clearing count cache
2025-07-09 10:55:41.423 DEBUG [ApiCacheManager] book.afterCreate: Clearing cache
2025-07-09 10:55:41.427 DEBUG [ApiCacheManager] libraryItem.afterCreate: Clearing cache
2025-07-09 10:55:41.430 DEBUG [Scan] "test_book.epub": Success saving abmetadata to "/metadata/items/68f3544d-b7e5-4f41-9b70-806bc6ad3987/metadata.json"
2025-07-09 10:55:41.431 DEBUG [Scan] "test_book.epub": Created new library item "test_book.epub" with id "68f3544d-b7e5-4f41-9b70-806bc6ad3987"
2025-07-09 10:55:41.431 DEBUG [LibraryScanner] Folder scan results { 'test_book.epub': 1 }
2025-07-09 10:55:41.660 DEBUG [ApiCacheManager] count: 0 size: 0
2025-07-09 10:55:41.674 DEBUG Loaded 0 of 0 items for "Continue Listening/Reading" in 0.01s
2025-07-09 10:55:41.683 DEBUG Loaded 0 of 0 items for "Continue Series" in 0.01s
2025-07-09 10:55:41.694 DEBUG Loaded 10 of 51 items for "Recently Added" in 0.01s
2025-07-09 10:55:41.705 DEBUG Loaded 2 of 2 series for "Recent Series" in 0.01s
2025-07-09 10:55:41.722 DEBUG Loaded 10 of 27 items for "Discover" in 0.02s
2025-07-09 10:55:41.725 DEBUG Loaded 0 of 0 items for "Listen/Read Again" in 0.00s
2025-07-09 10:55:41.728 DEBUG Loaded 6 of 6 authors for "Newest Authors" in 0.00s
2025-07-09 10:55:41.728 DEBUG Loaded 4 personalized shelves in 0.06s
2025-07-09 10:55:41.728 DEBUG [ApiCacheManager] Cache miss: {"user":"root","url":"/libraries/cef9aef1-ccc1-4b44-9d71-590865992b73/personalized?include=rssfeed,numEpisodesIncomplete,share"}
2025-07-09 10:55:41.728 DEBUG [ApiCacheManager] Caching with 1800000 ms TTL

Image

@FiendFEARing commented on GitHub (Jul 9, 2025): > Can you provide logs for this? The logs show step by step what the scanner is doing. ``` 2025-07-09 10:55:15.427 DEBUG [ApiCacheManager] Caching with 1800000 ms TTL 2025-07-09 10:55:29.039 DEBUG [ApiCacheManager] Object.afterBulkDestroy: Clearing cache 2025-07-09 10:55:29.052 DEBUG [CacheManager] Going to purge bda83e5b-b3f8-42f4-8ab1-b553a42d6557_400.webp 2025-07-09 10:55:29.053 INFO [ApiRouter] Removing item metadata at "/metadata/items/bda83e5b-b3f8-42f4-8ab1-b553a42d6557" 2025-07-09 10:55:29.063 DEBUG [ApiCacheManager] libraryItem.afterDestroy: Clearing cache 2025-07-09 10:55:29.063 DEBUG [ApiCacheManager] Object.afterBulkDestroy: Clearing cache 2025-07-09 10:55:29.063 INFO [LibraryItemController] Deleting library item from file system at "/audiobooks/图书/test_book.epub" 2025-07-09 10:55:29.068 DEBUG [LibraryItemsBookFilters] book.afterDestroy: Clearing count cache 2025-07-09 10:55:29.068 DEBUG [ApiCacheManager] book.afterDestroy: Clearing cache 2025-07-09 10:55:31.407 DEBUG [Watcher] File Removed /audiobooks/图书/test_book.epub 2025-07-09 10:55:31.408 DEBUG [Watcher] Modified file in library "图书" and folder "4dec5e60-50bd-4d47-93d3-51e867111e1c" with relPath "/test_book.epub" 2025-07-09 10:55:41.414 DEBUG [Scanner] Scanning file update groups in folder "4dec5e60-50bd-4d47-93d3-51e867111e1c" of library "图书" 2025-07-09 10:55:41.415 DEBUG [Scanner] scanFolderUpdates fileUpdateGroup { 'test_book.epub': 'test_book.epub' } 2025-07-09 10:55:41.417 ERROR [Utils] Failed to get ino for path /audiobooks/图书/test_book.epub [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' } 2025-07-09 10:55:41.417 ERROR [Utils] Failed to get ino for path /audiobooks/图书/test_book.epub [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' } 2025-07-09 10:55:41.418 DEBUG [LibraryScanner] Folder update group must be a new item "test_book.epub" in library "图书" 2025-07-09 10:55:41.419 ERROR [fileUtils] Failed to getFileTimestampsWithIno for path "/audiobooks/图书/test_book.epub" [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' } 2025-07-09 10:55:41.419 ERROR [fileUtils] Failed to getFileTimestampsWithIno for path "/audiobooks/图书/test_book.epub" [Error: ENOENT: no such file or directory, stat '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/audiobooks/图书/test_book.epub' } 2025-07-09 10:55:41.419 DEBUG Parsing metadata from epub at "/audiobooks/图书/test_book.epub" 2025-07-09 10:55:41.419 ERROR [parseEpubMetadata] Failed to extract META-INF/container.xml from epub at "/audiobooks/图书/test_book.epub" [Error: ENOENT: no such file or directory, open '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'open', path: '/audiobooks/图书/test_book.epub' } 2025-07-09 10:55:41.419 ERROR [parseEpubMetadata] Failed to close zip [Error: ENOENT: no such file or directory, open '/audiobooks/图书/test_book.epub'] { errno: -2, code: 'ENOENT', syscall: 'open', path: '/audiobooks/图书/test_book.epub' } 2025-07-09 10:55:41.420 DEBUG [Scan] "test_book.epub": "test_book" Getting metadata with precedence [folderStructure, audioMetatags, nfoFile, txtFiles, opfFile, absMetadata] 2025-07-09 10:55:41.423 DEBUG [LibraryItemsBookFilters] book.afterCreate: Clearing count cache 2025-07-09 10:55:41.423 DEBUG [ApiCacheManager] book.afterCreate: Clearing cache 2025-07-09 10:55:41.427 DEBUG [ApiCacheManager] libraryItem.afterCreate: Clearing cache 2025-07-09 10:55:41.430 DEBUG [Scan] "test_book.epub": Success saving abmetadata to "/metadata/items/68f3544d-b7e5-4f41-9b70-806bc6ad3987/metadata.json" 2025-07-09 10:55:41.431 DEBUG [Scan] "test_book.epub": Created new library item "test_book.epub" with id "68f3544d-b7e5-4f41-9b70-806bc6ad3987" 2025-07-09 10:55:41.431 DEBUG [LibraryScanner] Folder scan results { 'test_book.epub': 1 } 2025-07-09 10:55:41.660 DEBUG [ApiCacheManager] count: 0 size: 0 2025-07-09 10:55:41.674 DEBUG Loaded 0 of 0 items for "Continue Listening/Reading" in 0.01s 2025-07-09 10:55:41.683 DEBUG Loaded 0 of 0 items for "Continue Series" in 0.01s 2025-07-09 10:55:41.694 DEBUG Loaded 10 of 51 items for "Recently Added" in 0.01s 2025-07-09 10:55:41.705 DEBUG Loaded 2 of 2 series for "Recent Series" in 0.01s 2025-07-09 10:55:41.722 DEBUG Loaded 10 of 27 items for "Discover" in 0.02s 2025-07-09 10:55:41.725 DEBUG Loaded 0 of 0 items for "Listen/Read Again" in 0.00s 2025-07-09 10:55:41.728 DEBUG Loaded 6 of 6 authors for "Newest Authors" in 0.00s 2025-07-09 10:55:41.728 DEBUG Loaded 4 personalized shelves in 0.06s 2025-07-09 10:55:41.728 DEBUG [ApiCacheManager] Cache miss: {"user":"root","url":"/libraries/cef9aef1-ccc1-4b44-9d71-590865992b73/personalized?include=rssfeed,numEpisodesIncomplete,share"} 2025-07-09 10:55:41.728 DEBUG [ApiCacheManager] Caching with 1800000 ms TTL ``` ![Image](https://github.com/user-attachments/assets/b8cb9513-a409-4605-9f35-0ae9e06b08e2)
Author
Owner

@advplyr commented on GitHub (Jul 9, 2025):

Thanks, I was able to reproduce the issue. This is specific to single-file books in the root folder

@advplyr commented on GitHub (Jul 9, 2025): Thanks, I was able to reproduce the issue. This is specific to single-file books in the root folder
Author
Owner

@github-actions[bot] commented on GitHub (Jul 12, 2025):

Fixed in v2.26.0.

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

No dependencies set.

Reference: starred/audiobookshelf#2870