mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Bug]: Restoring from large AudioBookShelf backup results in broken Author images and "Internal Server Error" #1931
Closed
opened 2026-04-25 00:01:29 +02:00 by adam
·
18 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
sqlite
playlists
video
v2.35.1
v2.35.0
v2.34.0
v2.33.2
v2.33.1
v2.33.0
v2.32.1
v2.32.0
v2.31.0
v2.30.0
v2.29.0
v2.28.0
v2.27.0
v2.26.3
v2.26.2
v2.26.1
v2.26.0
v2.25.1
v2.25.0
v2.24.0
v2.23.0
v2.22.0
v2.21.0
v2.20.0
v2.19.5
v2.19.4
v2.19.3
v2.19.2
v2.19.1
v2.19.0
v2.18.1
v2.18.0
v2.17.7
v2.17.6
v2.17.5
v2.17.4
v2.17.3
v2.17.2
v2.17.1
v2.17.0
v2.16.2
v2.16.1
v2.16.0
v2.15.1
v2.15.0
v2.14.0
v2.13.4
v2.13.3
v2.13.2
v2.13.1
v2.13.0
v2.12.3
v2.12.2
v2.12.1
v2.12.0
v2.11.0
v2.10.1
v2.10.0
v2.9.0
v2.8.1
v2.8.0
v2.7.2
v2.7.1
v2.7.0
v2.6.0
v2.5.0
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
v2.3.5
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.23
v2.2.22
v2.2.21
v2.2.20
v2.2.19
v2.2.18
v2.2.17
v2.2.16
v2.2.15
v2.2.14
v2.2.13
v2.2.12
v2.2.11
v2.2.10
v2.2.9
v2.2.8
v2.2.7
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.24
v2.0.23
v2.0.22
v2.0.21
v2.0.20
v2.0.19
v2.0.18
v2.0.17
v2.0.16
v2.0.15
v2.0.14
v2.0.13
v2.0.12
v2.0.11
v2.0.10
v2.0.9
v2.0.8
v2.0.7
v2.0.6
v2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
v1.7.2
v1.7.1
v1.7.0
v1.6.0
v1.5.5
v1.5.0
v1.4.11
v1.4.9
v1.4.7
v1.4.6
v1.4.4
v1.4.2
v1.4.0
v1.4.1
v1.3.4
v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#1931
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ZLoth on GitHub (May 2, 2024).
Describe the issue
Because of a botched upgrade of the TrueCharts docker container, I ended up killing my original AudioBookShelf instance and creating a new instance. I then restored the backup from the latest nightly AudioBookShelf backup from Settings → Backup. While my book images and data was restored properly, most of the Author images were broken. In checking the directory /metadata/authors, I did not see the picture uploaded. I ended up deleting the broken image and then doing a quick match to restore the image.
Example screenshot:

Here is a recording of the issue: https://github.com/advplyr/audiobookshelf/assets/6700159/68e47f52-48f9-4398-817a-ac95a7a1b273
The UUID attached to the author is adeeccd0-cb1a-4647-9516-f8a63fdb24be on my instance, but when I check the /metadata/authors directory, the image does not exist:

Steps to reproduce the issue
WHAT SHOULD HAPPEN: Author metadata and images are restored as well as book images and metadata.
WHAT REALLY HAPPENS: Author images are not restored.
WORKAROUND 1: Individually remove the image, then do a quick match again to restore data.
WORKAROUND 2: Extract the photos from the backup in metadata-authors, then manually copy the photos into metadata/authors.
Audiobookshelf version
2.9.0, 2.11.0
How are you running audiobookshelf?
Docker
@Mega-Cookie commented on GitHub (Jun 12, 2024):
Had a similar Issue where the metadata/authors/ directory was not created at all after restoring from backup.
I'm also running a Docker container
MY WORKARROUND:
@ZLoth commented on GitHub (Jul 12, 2024):
Issue is still occurring in 2.11 . But, I was able to restore the authors per your workaround.
@nichwall commented on GitHub (Jul 14, 2024):
Are you able to get any logs of the backup restore? I'm not able to reproduce the issue of author images not being restored using Docker version
2.11.0My debug steps:
/metadata/authors/metadata/cacheto make sure images were missing and that they did not show up in the UI)/metadata/authors, and author images appear in web interfaceI also tried:
/metadata/authors, and author images appear in web interface. The author image I changed after the backup was made did correctly restore to the original version@ZLoth commented on GitHub (Jul 20, 2024):
@nichwall : My apologies for the delay as I was not able to attempt a reproduction of the issue until this weekend. My configuration is that I'm running TrueNAS Scale running Dragonfish-24.04.2, and I'm using a Docker container. My testing is that I set up a second test instance of ABS, with the only difference is that my production Config Storage and Metadata Storage, configured to use Host Path, pointed to /mnt/pool/app-config/abs-test instead of my production directory of /mnt/pool/app-config/audiobookshelf , and the port used was different from production.
STEPS TO REPLICATE:
WHAT SHOULD HAPPEN: Pictures should have been restored.
WHAT REALLY HAPPENS: Multiple errors thrown in the logs, and no pictures in the authors directory.
Here is a recording of the issue. My apologies for the big yellow box, as I don't want my users to be displayed.
https://github.com/user-attachments/assets/4a7dc434-2f7a-4a5c-a457-bf7b9c7dcc4e
Here are the log files: Logs.zip
@nichwall commented on GitHub (Jul 20, 2024):
Thanks for providing more information. I just tried following your steps (using the same hardware, but an entirely new directory path/container). I am not seeing the socket disconnect and reconnect or any errors in my logs. Granted, the largest backup file I have on hand for this is only about 200 MB.
I noticed in your video that your backup is 1.4 GB, do you have any smaller backups you could try?
Based on the log file showing that
/metadata/authors/0003ec65-73d1-4c34-bcd2-4ba65abb6d7d.jpgcannot be found while restoring the backup, I'm wondering if it could be:Can you answer/do the following:
metadata-items?metadata-authors/0003ec65-73d1-4c34-bcd2-4ba65abb6d7d.jpgexists in the backup./metadata/authorsafter the extraction and see if any files exist in the file system?@ZLoth commented on GitHub (Jul 21, 2024):
Negative. This is my daily backup of my production instance, and has over 4,400 books (thanks Plus catalog)
As you can see from the following five-minute recording where I went from adding the app in TrueNAS scale as a second instance, setting up the paths, restoring the backup, etc , both /metadata/items and /metadata/authors do not exist until I attempt restore from backup. After restoration from backup, items exist, but authors does not exist. It's only when I update the photo does the authors directory exist.
https://github.com/user-attachments/assets/410d5c42-9287-41af-baa1-09b13c03b5d5
Log files: Logs.zip
@nichwall commented on GitHub (Jul 21, 2024):
Why is
absdatabase.sqlitein your metadata folder (at 2:27)? Having config and metadata at the same mount point may be causing some of the problems.@ZLoth commented on GitHub (Jul 21, 2024):
Here is a recording where I created the subdirectories config and metadata as subdirectories under /mnt/pool/app-config/abs-test:
https://github.com/user-attachments/assets/3728bc04-e08a-471d-9da8-1fc1d699f962
Here is a recording where I created directories /mnt/pool/app-config/abs-config and /mnt/pool/app-config/abs-metadata:
https://github.com/user-attachments/assets/de0d6df3-ca9f-4cb7-9ac2-2febd59342e3
Still same issue.
@ZLoth commented on GitHub (Jul 21, 2024):
And, just for fun, I'm using the IX defaults for the metadata and config:
https://github.com/user-attachments/assets/7fc44168-7ace-4862-823e-8dc4b00a82a5
@ZLoth commented on GitHub (Jul 21, 2024):
What is the order of the restoration of the backup? Is it items, then the sqlite DB, then authors?
@nichwall commented on GitHub (Jul 21, 2024):
SQLite, items, then authors
https://github.com/advplyr/audiobookshelf/blob/master/server%2Fmanagers%2FBackupManager.js#L171-L233
@nichwall commented on GitHub (Jul 21, 2024):
If you're willing to DM a download link for the backup file, I can try and recreate the issue specifically from your backup. (Though, maybe change the admin user password to "password" or something so it's easier for me to actually log in and verify things)
@ZLoth commented on GitHub (Jul 21, 2024):
@nichwall : As the file is 1.5 GB in size, a WeTransfer link has been sent to you directly. The link will expire on July 24th.
@nichwall commented on GitHub (Jul 21, 2024):
Thanks, I was able to reproduce the server crash during restoring the backup with your backup file and was able to log in using the new password you created.
I'll see if I can find more information.
@nichwall commented on GitHub (Jul 21, 2024):
Okay, pretty sure I found the problem.
In your
/metadata/authorsfolder, there are only files (no directories). Backups from my main server (running on Synology) have a hidden folder@eaDirin/metadata/authors. It looks like folders are only created during extraction if there is a folder in the path, so whenmetadata-authors/is extracted from the backup, you don't have a folder undermetadata-authors/, so theauthorsdirectory is not created in the file system. This does not matter for the database because it is extracting a single file to an existing folder, and themetadata-items/part of the backup is a bunch of folders so/metadata/itemsgets created.I added a dummy folder (tried different names to make sure alphabetical sorting didn't matter) to your
/metadata/authorsfolder, made a backup, and then was able to successfully restore the backup on a new server. I also verified that deleting the hidden folder from my backup caused restoring from backup to fail.@ZLoth commented on GitHub (Jul 21, 2024):
As a test, I manually created the authors and items folders, chown-ed them to be the apps owner, then performed the restore. This time, no crash, and the authors were restored. So, per your pull request, ensuring that authors and Items folders are created prior to restore is a good fix.
https://github.com/user-attachments/assets/54cb0b9b-980f-4dc8-9703-6d5311e5a990
And all of the authors were restored.
https://github.com/user-attachments/assets/0b2b7995-103e-4f19-b1c9-a8738fff7d3f
Thank you for tracking this issue down. I look forward to the fix, although hopefully, I won't have to do a restore for quite a while.
@ZLoth commented on GitHub (Jul 23, 2024):
Thank you!
@github-actions[bot] commented on GitHub (Aug 5, 2024):
Fixed in v2.12.0.