[Bug]: 2.4.1 Docker exits when trying to match books #1367

Closed
opened 2026-04-24 23:42:24 +02:00 by adam · 8 comments
Owner

Originally created by @ReaderGuy42 on GitHub (Sep 10, 2023).

Describe the issue

Just updated the docker container to 2.4.1 and when I try matching the entire library the container exits immediately, and when "Quick Match"ing manually, it exits after a few books

Steps to reproduce the issue

  1. either match entire library or match books manually
  2. docker container exits

Audiobookshelf version

2.4.1

How are you running audiobookshelf?

Docker

Originally created by @ReaderGuy42 on GitHub (Sep 10, 2023). ### Describe the issue Just updated the docker container to 2.4.1 and when I try matching the entire library the container exits immediately, and when "Quick Match"ing manually, it exits after a few books ### Steps to reproduce the issue 1. either match entire library or match books manually 2. docker container exits ### Audiobookshelf version 2.4.1 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:42:24 +02:00
adam closed this issue 2026-04-24 23:42:24 +02:00
Author
Owner

@tigerkzr commented on GitHub (Sep 10, 2023):

I might be having a similar issue..

When I match a book and then click "save" I get the following warning in the log and the socket restarts:

2023-09-10 16:34:58
WARN
[ApiRouter] Author id "new-8868" does not exist
2023-09-10 16:34:58
WARN
[ApiRouter] Series id "new-3348" does not exist
2023-09-10 16:35:00
INFO
=== Starting Server ===
2023-09-10 16:35:00
INFO
[Server] Init v2.4.1
2023-09-10 16:35:00
INFO
[Database] Initializing db at "/config/absdatabase.sqlite"
2023-09-10 16:35:00
INFO
[Database] Db connection was successful
2023-09-10 16:35:00
INFO
[Database] Db initialized with models: user, library, libraryFolder, book, podcast, podcastEpisode, libraryItem, mediaProgress, series, bookSeries, author, bookAuthor, collection, collectionBook, playlist, playlistMediaItem, device, playbackSession, feed, feedEpisode, setting
2023-09-10 16:35:00
INFO
[BackupManager] 5 Backups Found
2023-09-10 16:35:00
INFO
[LogManager] Init current daily log filename: 2023-09-10.txt
2023-09-10 16:35:00
INFO
Listening on port :80
2023-09-10 16:35:01
INFO
[SocketAuthority] Socket Connected 03-_Z7FzmRuzMCHbAAAB
@tigerkzr commented on GitHub (Sep 10, 2023): I might be having a similar issue.. When I match a book and then click "save" I get the following warning in the log and the socket restarts: ``` 2023-09-10 16:34:58 WARN [ApiRouter] Author id "new-8868" does not exist 2023-09-10 16:34:58 WARN [ApiRouter] Series id "new-3348" does not exist 2023-09-10 16:35:00 INFO === Starting Server === 2023-09-10 16:35:00 INFO [Server] Init v2.4.1 2023-09-10 16:35:00 INFO [Database] Initializing db at "/config/absdatabase.sqlite" 2023-09-10 16:35:00 INFO [Database] Db connection was successful 2023-09-10 16:35:00 INFO [Database] Db initialized with models: user, library, libraryFolder, book, podcast, podcastEpisode, libraryItem, mediaProgress, series, bookSeries, author, bookAuthor, collection, collectionBook, playlist, playlistMediaItem, device, playbackSession, feed, feedEpisode, setting 2023-09-10 16:35:00 INFO [BackupManager] 5 Backups Found 2023-09-10 16:35:00 INFO [LogManager] Init current daily log filename: 2023-09-10.txt 2023-09-10 16:35:00 INFO Listening on port :80 2023-09-10 16:35:01 INFO [SocketAuthority] Socket Connected 03-_Z7FzmRuzMCHbAAAB ```
Author
Owner

@ender89 commented on GitHub (Sep 11, 2023):

Same issue, I pulled the error logs from the container and the crash is being caused by a sqlite error. The inputs are not being sanitized and single quotes in a book's title will cause the match function to fail due to a corrupted sql string.

sql: "SELECT id, name, nameIgnorePrefix, description, createdAt, updatedAt, libraryId FROM series AS series WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND series.libraryId = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;"

node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
Error
at Database. (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27)
at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50
at new Promise ()
at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12)
at /node_modules/sequelize/lib/sequelize.js:315:28
at async SQLiteQueryInterface.select (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12)
at async Function.findAll (/node_modules/sequelize/lib/model.js:1140:21)
at async Function.findOne (/node_modules/sequelize/lib/model.js:1240:12)
at async Function.getOldByNameAndLibrary (/server/models/Series.js:106:21)
at async Scanner.quickMatchBookBuildUpdatePayload (/server/scanner/Scanner.js:207:26) {
name: 'SequelizeDatabaseError',
parent: [Error: SQLITE_ERROR: near "s": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: "SELECT id, name, nameIgnorePrefix, description, createdAt, updatedAt, libraryId FROM series AS series WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND series.libraryId = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;"
},
original: [Error: SQLITE_ERROR: near "s": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: "SELECT id, name, nameIgnorePrefix, description, createdAt, updatedAt, libraryId FROM series AS series WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND series.libraryId = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;"
},
sql: "SELECT id, name, nameIgnorePrefix, description, createdAt, updatedAt, libraryId FROM series AS series WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND series.libraryId = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;",
parameters: {}
}

@ender89 commented on GitHub (Sep 11, 2023): Same issue, I pulled the error logs from the container and the crash is being caused by a sqlite error. The inputs are not being sanitized and single quotes in a book's title will cause the match function to fail due to a corrupted sql string. > sql: "SELECT `id`, `name`, `nameIgnorePrefix`, `description`, `createdAt`, `updatedAt`, `libraryId` FROM `series` AS `series` WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND `series`.`libraryId` = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;" > node:internal/process/promises:279 > triggerUncaughtException(err, true /* fromPromise */); > ^ > Error > at Database.<anonymous> (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27) > at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50 > at new Promise (<anonymous>) > at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12) > at /node_modules/sequelize/lib/sequelize.js:315:28 > at async SQLiteQueryInterface.select (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12) > at async Function.findAll (/node_modules/sequelize/lib/model.js:1140:21) > at async Function.findOne (/node_modules/sequelize/lib/model.js:1240:12) > at async Function.getOldByNameAndLibrary (/server/models/Series.js:106:21) > at async Scanner.quickMatchBookBuildUpdatePayload (/server/scanner/Scanner.js:207:26) { > name: 'SequelizeDatabaseError', > parent: [Error: SQLITE_ERROR: near "s": syntax error] { > errno: 1, > code: 'SQLITE_ERROR', > sql: "SELECT `id`, `name`, `nameIgnorePrefix`, `description`, `createdAt`, `updatedAt`, `libraryId` FROM `series` AS `series` WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND `series`.`libraryId` = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;" > }, > original: [Error: SQLITE_ERROR: near "s": syntax error] { > errno: 1, > code: 'SQLITE_ERROR', > sql: "SELECT `id`, `name`, `nameIgnorePrefix`, `description`, `createdAt`, `updatedAt`, `libraryId` FROM `series` AS `series` WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND `series`.`libraryId` = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;" > }, > sql: "SELECT `id`, `name`, `nameIgnorePrefix`, `description`, `createdAt`, `updatedAt`, `libraryId` FROM `series` AS `series` WHERE (name = 'Hitchhiker's Guide to the Galaxy' COLLATE NOCASE AND `series`.`libraryId` = '9c72bc90-67d4-4171-8bba-25b7954f57a3') LIMIT 1;", > parameters: {} > }
Author
Owner

@ReaderGuy42 commented on GitHub (Sep 11, 2023):

@ender89 That's funny! I'm also having trouble with Hitchhiker's Guide to the Galaxy

@ReaderGuy42 commented on GitHub (Sep 11, 2023): @ender89 That's funny! I'm also having trouble with Hitchhiker's Guide to the Galaxy
Author
Owner

@ReaderGuy42 commented on GitHub (Sep 11, 2023):

Actually! Just tried matching a series called "The Old Man's War" and if I try quick matching or manually matching that it exits the container. But if I try e.g. The Old Mans War without the apostrophe it seems to work. So could the apostrophe be the problem?

@ReaderGuy42 commented on GitHub (Sep 11, 2023): Actually! Just tried matching a series called "The Old Man's War" and if I try quick matching or manually matching that it exits the container. But if I try e.g. `The Old Mans War` without the apostrophe it seems to work. So could the apostrophe be the problem?
Author
Owner

@nichwall commented on GitHub (Sep 11, 2023):

Looks like it's also an issue with authors having an apostrophe
#2070

@nichwall commented on GitHub (Sep 11, 2023): Looks like it's also an issue with authors having an apostrophe #2070
Author
Owner

@ReaderGuy42 commented on GitHub (Sep 11, 2023):

It may also apply to titles. However, the problem seems to only occur during the matching process. I.e. after matching I can change or add series and titles with apostrophes and it mostly works.

@ReaderGuy42 commented on GitHub (Sep 11, 2023): It may also apply to titles. However, the problem seems to only occur during the matching process. I.e. after matching I can change or add series and titles with apostrophes and it mostly works.
Author
Owner

@advplyr commented on GitHub (Sep 12, 2023):

I just fixed this. The issue is specific to updating a book with an author or series that has an apostrophe. I updated the title of #2070 to be more accurate and will use that as the primary issue request

@advplyr commented on GitHub (Sep 12, 2023): I just fixed this. The issue is specific to updating a book with an author or series that has an apostrophe. I updated the title of #2070 to be more accurate and will use that as the primary issue request
Author
Owner

@advplyr commented on GitHub (Sep 12, 2023):

Duplicate of #2070

@advplyr commented on GitHub (Sep 12, 2023): Duplicate of #2070
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1367