[Bug]: Crash when matching a book and the author name ends in a comma #1843

Closed
opened 2026-04-24 23:59:45 +02:00 by adam · 4 comments
Owner

Originally created by @gardiol on GitHub (Mar 28, 2024).

Describe the issue

[audiobookshelf] | [2024-03-28 11:32:09.558] INFO: Listening on port :80
[audiobookshelf] | [2024-03-28 11:32:09.593] INFO: [Watcher] "Podcasts" Ready
[audiobookshelf] | [2024-03-28 11:32:09.700] INFO: [Watcher] "Audiolibri" Ready
[audiobookshelf] | [2024-03-28 11:32:20.777] INFO: [CoverManager] Downloaded libraryItem cover "/audiobooks/Casa Surace/cover.jpg" from url "https://books.google.com/books/content?id=OGx2Dwprintsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" for "Quest'anno non scendo"
[2024-03-28 11:32:20.786] ERROR: [ApiRouter] Invalid author object, no name { id: 'new-3401', name: '' } (ApiRouter.js:533)
[2024-03-28 11:32:20.840] FATAL: [Server] Unhandled rejection: SequelizeForeignKeyConstraintError: SQLITE_CONSTRAINT: FOREIGN KEY constraint failed, promise: Promise {
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.insert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:308:21)
at async BookAuthor.save (/node_modules/sequelize/lib/model.js:2490:35)
at async bookAuthor.create (/node_modules/sequelize/lib/model.js:1362:12)
at async libraryItem.fullUpdateFromOld (/server/models/LibraryItem.js:330:13)
at async Database.updateLibraryItem (/server/Database.js:430:21) {
name: 'SequelizeForeignKeyConstraintError',
parent: [Error: SQLITE_CONSTRAINT: FOREIGN KEY constraint failed] {
errno: 19,
code: 'SQLITE_CONSTRAINT',
sql: 'INSERT INTO bookAuthors (id,createdAt,bookId,authorId) VALUES ($1,$2,$3,$4);'
},
original: [Error: SQLITE_CONSTRAINT: FOREIGN KEY constraint failed] {
errno: 19,
code: 'SQLITE_CONSTRAINT',
sql: 'INSERT INTO bookAuthors (id,createdAt,bookId,authorId) VALUES ($1,$2,$3,$4);'
},
sql: 'INSERT INTO bookAuthors (id,createdAt,bookId,authorId) VALUES ($1,$2,$3,$4);',
parameters: {},
table: undefined,
fields: undefined,
value: undefined,
index: undefined,
reltype: undefined
}
} (Server.js:164)
exit code: 1

Steps to reproduce the issue

Edit book, search for book details, import them. ABS will crash with above log failing the import.

the book is "Quest'anno non scendo" ISBN 9788893427623

Audiobookshelf version

v2.8.1

How are you running audiobookshelf?

Docker

Originally created by @gardiol on GitHub (Mar 28, 2024). ### Describe the issue [audiobookshelf] | [2024-03-28 11:32:09.558] INFO: Listening on port :80 [audiobookshelf] | [2024-03-28 11:32:09.593] INFO: [Watcher] "Podcasts" Ready [audiobookshelf] | [2024-03-28 11:32:09.700] INFO: [Watcher] "Audiolibri" Ready [audiobookshelf] | [2024-03-28 11:32:20.777] INFO: [CoverManager] Downloaded libraryItem cover "/audiobooks/Casa Surace/cover.jpg" from url "https://books.google.com/books/content?id=OGx2Dwprintsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api" for "Quest'anno non scendo" [2024-03-28 11:32:20.786] ERROR: [ApiRouter] Invalid author object, no name { id: 'new-3401', name: '' } (ApiRouter.js:533) [2024-03-28 11:32:20.840] FATAL: [Server] Unhandled rejection: SequelizeForeignKeyConstraintError: SQLITE_CONSTRAINT: FOREIGN KEY constraint failed, promise: Promise { <rejected> 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.insert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:308:21) at async BookAuthor.save (/node_modules/sequelize/lib/model.js:2490:35) at async bookAuthor.create (/node_modules/sequelize/lib/model.js:1362:12) at async libraryItem.fullUpdateFromOld (/server/models/LibraryItem.js:330:13) at async Database.updateLibraryItem (/server/Database.js:430:21) { name: 'SequelizeForeignKeyConstraintError', parent: [Error: SQLITE_CONSTRAINT: FOREIGN KEY constraint failed] { errno: 19, code: 'SQLITE_CONSTRAINT', sql: 'INSERT INTO `bookAuthors` (`id`,`createdAt`,`bookId`,`authorId`) VALUES ($1,$2,$3,$4);' }, original: [Error: SQLITE_CONSTRAINT: FOREIGN KEY constraint failed] { errno: 19, code: 'SQLITE_CONSTRAINT', sql: 'INSERT INTO `bookAuthors` (`id`,`createdAt`,`bookId`,`authorId`) VALUES ($1,$2,$3,$4);' }, sql: 'INSERT INTO `bookAuthors` (`id`,`createdAt`,`bookId`,`authorId`) VALUES ($1,$2,$3,$4);', parameters: {}, table: undefined, fields: undefined, value: undefined, index: undefined, reltype: undefined } } (Server.js:164) exit code: 1 ### Steps to reproduce the issue Edit book, search for book details, import them. ABS will crash with above log failing the import. the book is "Quest'anno non scendo" ISBN 9788893427623 ### Audiobookshelf version v2.8.1 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:59:45 +02:00
adam closed this issue 2026-04-24 23:59:45 +02:00
Author
Owner

@advplyr commented on GitHub (Mar 28, 2024):

What provider are you using to search for book details?

@advplyr commented on GitHub (Mar 28, 2024): What provider are you using to search for book details?
Author
Owner

@advplyr commented on GitHub (Mar 28, 2024):

I found the issue and fixed for the next release. It had to do with this trailing comma that google books provider was returning.

image

@advplyr commented on GitHub (Mar 28, 2024): I found the issue and fixed for the next release. It had to do with this trailing comma that google books provider was returning. ![image](https://github.com/advplyr/audiobookshelf/assets/67830747/9df5f699-d5a2-497b-9092-289c5a5c12bf)
Author
Owner

@gardiol commented on GitHub (Mar 29, 2024):

I see! Thank you! i will clean the coma then.
Yes i am using Google Books

@gardiol commented on GitHub (Mar 29, 2024): I see! Thank you! i will clean the coma then. Yes i am using Google Books
Author
Owner

@advplyr commented on GitHub (Apr 22, 2024):

Fixed in v2.9.0

@advplyr commented on GitHub (Apr 22, 2024): Fixed in [v2.9.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.9.0)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1843