mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Bug]: Incorrect chapter generation (224 → 25,200) leads to editor crash #2989
Open
opened 2026-04-25 00:12:46 +02:00 by adam
·
13 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#2989
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 @crammaster on GitHub (Sep 7, 2025).
What happened?
Problem Description:
When I add an audiobook, there is an error in the way chapters are generated. Instead of the expected 224 chapters, the system creates 25,200 chapters. It looks like each chapter gets counted repeatedly from 1 to 224 (e.g. 1 → 224, 2 → 224, …), until it finally stops at 224. With larger audiobooks, this number can easily grow to over 100,000 chapters.
pic1.bmp
pic2.bmp
pic3.bmp
pic4.bmp
Impact:
The real issue starts when I try to edit the chapters:
The page with tens of thousands of chapters never finishes loading.
After some time, the client loses the socket connection.
As a result, functions like “search chapters” or overwriting chapters become unusable.
Suggested Improvement:
A possible workaround would be to paginate the chapter editing page. For example, after every 1,000 chapters the editor could continue on a new page. This would greatly reduce load times and make editing possible again.
In practice, most audiobooks have far fewer than 1,000 chapters, so pagination would not cause any drawback.
What did you expect to happen?
The chapter editor page loads without any problems.
Steps to reproduce the issue
Audiobookshelf version
v2.29.0
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?
Firefox
Logs
Additional Notes
The audiobooks are in MP3 format from a large audiobook provider.
Before adding them to ABS, I edit them with MP3Tag.
I adjust the track number, title, and author metadata.
@nichwall commented on GitHub (Sep 7, 2025):
Can you provide logs of how you got that many chapters? There should be scan logs on
/metadata/logs/scans@crammaster commented on GitHub (Sep 7, 2025):
2025-09-07.txt
pic5.bmp
Scan was empty, i found this in daily. I added an audiobook and tried to edit the chapters of another audiobook (25k chapters).
@Vito0912 commented on GitHub (Sep 7, 2025):
Can you please share a screenshot of the "Manage Tracks".
Please choose a position where there is a situation where the chapters are wrong.
PS: What (potential german) book has 25k chapters xD?
@crammaster commented on GitHub (Sep 7, 2025):
Eng:
The tracks are all fine—there are 224 tracks, one for each chapter. But in the chapter overview, the counting is quite strange.
1 -> 224, 2 -> 224, 3 -> 224, ..., 223 -> 224, 224. This is what accounts for this high number of chapters.
Deu:
Mit den Tracks ist alles okay, das sind es die 224 Tracks, für jedes Kapitel eins. Aber in der Kapitelübersicht, zählt er ganz komisch.
1 -> 224, 2 -> 224, 3 -> 224, ..., 223 -> 224, 224. Dadurch kommt diese hohe Anzahl an Kapitels zustande.
pic6.bmp
@Vito0912 commented on GitHub (Sep 7, 2025):
Ah, sorry. I just now understand the real issue. My mistake. I thought it was supposed to be 25,200 (yes, there are books with that many chapters, and there have been issues with that number of chapters in the past, so I assumed that was what you meant). But now where I reread, yeah, you cleary stated the actual issue.
The only thing I could imagine is that each file contains the chapter data and ABS reads the chapters from each file. @nichwall Do you know what happens in that case? I do not really work with multiple files.
From the uploaded logs that
does notdoes seem to be the casethough.What you could try is to block the requests that loads the chapters (in another book that has less chapters) and try opening the editor. I am not sure if that will load at all then, but if not you could try to overwrite it with 1 chapter only and then load the chapters from the file again
Edit: Just tried. Does not work :/
What does work is changing the chapters via the API:
POST
https://<domain>/audiobookshelf/api/items/<item-id>/chaptersPayload
@crammaster commented on GitHub (Sep 7, 2025):
My suspicion was that something was hidden in the tags, but I couldn't find anything with MP3Tag.
What tool could I use to check whether chapter information is stored in the audio files?
@Vito0912
The fact that there are too many chapters doesn't bother me, since I change the chapter information anyway using the "Find Chapters" function. The problem is that if there are more than 20,000 chapters, the page no longer loads correctly, and the connection to the WebSocket breaks.
@Vito0912 commented on GitHub (Sep 7, 2025):
That's probably because the client froze, which caused the websocket connection to drop.
Still, it should not happen that so many chapters are added in the first place.
As a final guess from my side, can you please send the ffprobe of two different files for the same book? (Under Audiotracks, where you clicked manage tracks, click the three dots instead, select more info, and at the top right choose "Probe Audio File")
@crammaster commented on GitHub (Sep 7, 2025):
""chapters": [
{
"id": 0,
"time_base": "1/1000",
"start": 0,
"start_time": "0.000000",
"end": 22731,
"end_time": "22.731000",
"tags": {
"title": "Chapter 1"
}
},
{
"id": 1,
"time_base": "1/1000",
"start": 22731,
"start_time": "22.731000",
"end": 234032,
"end_time": "234.032000",
"tags": {
"title": "Chapter 2"
}
},
{
"id": 2,
"time_base": "1/1000",
"start": 234032,
"start_time": "234.032000",
"end": 420651,
"end_time": "420.651000",
"tags": {
"title": "Chapter 3"
}
},
"
Apparently, the files contain chapter information. What tool can I use to remove it? Unfortunately, MP3Tag doesn't work.
@nichwall commented on GitHub (Sep 7, 2025):
I would need to look at it again, but if I'm remembering correctly the server checks for chapters in the first track (first file), and then will only include chapters from the other files if the chapters are different (i.e. different name or more than a threshold difference in time).
If the same chapters are included in every file, the duplicates should be filtered out.
Some releases will only put the chapter info for all chapters in the first file, some put all chapter info in every file, and some put only the chapters present in the file (the "most correct" in my opinion, but not as common based on reports).
@crammaster commented on GitHub (Sep 7, 2025):
This was Track 1 from the Audiobook, this is Track 2.
"chapters": [
{
"id": 0,
"time_base": "1/1000",
"start": 0,
"start_time": "0.000000",
"end": 211277,
"end_time": "211.277000",
"tags": {
"title": "Chapter 2"
}
},
{
"id": 1,
"time_base": "1/1000",
"start": 211277,
"start_time": "211.277000",
"end": 397895,
"end_time": "397.895000",
"tags": {
"title": "Chapter 3"
}
},
{
"id": 2,
"time_base": "1/1000",
"start": 397895,
"start_time": "397.895000",
"end": 588810,
"end_time": "588.810000",
"tags": {
"title": "Chapter 4"
}
},
It starts again at ID0 only the rest is different, which is why the chapters are stacked.
Now the big magical question is how do I remove the chapter information.
@Vito0912 commented on GitHub (Sep 7, 2025):
This might not work, as I am not sure what Windows removes.
But if you use Windows you should be able to select all files, right click it, go into the properties and iirc there should be a blue label to remove all metadata from the file.
But I am not sure if that includes such metatdata
@crammaster commented on GitHub (Sep 7, 2025):
The problem is that neither Windows nor MP3Tag display chapter information. Therefore, I haven't yet come across chapter information in MP3 files.
@crammaster commented on GitHub (Sep 9, 2025):
I finally figured out the issue – thanks a lot for your help, guys!
What caused it:
The MP3 files had hidden chapter info in them, structured like this:
Track 1 → Chapter ID 0 → Chapter 1 → Chapter ID 1 → Chapter 2 …
Track 2 → Chapter ID 0 → Chapter 2 → Chapter ID 1 → Chapter 3 …
and so on.
Like @nichwall mentioned, ABS checks for chapter data in the files. If the chapters are the same across multiple files, ABS just ignores the duplicates. But since mine were all slightly different, the chapters just kept stacking up – which explains why there were so many of them in the end.
The tool I was using (MP3Tag) doesn’t actually show these chapter tags. But you can get rid of them via "Utils" → "Remove unknown fields". Once they’re gone, the files don’t contain chapter info anymore, and ABS simply uses the track count as chapters.
Big thanks again to @nichwall and @Vito0912 for pointing me in the right direction!
Also, I agree that splitting the chapter view into subpages would make sense once the number of chapters gets too high. If you think I should open a feature request for that, just let me know.