[Bug]: SequelizeDatabaseError when updating book author or series name that includes an apostrophe #1360

Closed
opened 2026-04-24 23:41:09 +02:00 by adam · 1 comment
Owner

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

Describe the issue

Match of book when author name has an ' in the name fails to sequelize. Previously worked on older versions

Below is server log.

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/Author.js:115:21)
at async ApiRouter.createAuthorsAndSeriesForItemUpdate (/server/routers/ApiRouter.js:563:26) {
name: 'SequelizeDatabaseError',
parent: [Error: SQLITE_ERROR: near "Donnell": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: "SELECT id, name, lastFirst, asin, description, imagePath, createdAt, updatedAt, libraryId FROM authors AS author WHERE (name = 'Patrick K. O'Donnell' COLLATE NOCASE AND author.libraryId = 'd16a26f8-40f6-4f69-a78e-42f5b9025900') LIMIT 1;"
},
original: [Error: SQLITE_ERROR: near "Donnell": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: "SELECT id, name, lastFirst, asin, description, imagePath, createdAt, updatedAt, libraryId FROM authors AS author WHERE (name = 'Patrick K. O'Donnell' COLLATE NOCASE AND author.libraryId = 'd16a26f8-40f6-4f69-a78e-42f5b9025900') LIMIT 1;"
},
sql: "SELECT id, name, lastFirst, asin, description, imagePath, createdAt, updatedAt, libraryId FROM authors AS author WHERE (name = 'Patrick K. O'Donnell' COLLATE NOCASE AND author.libraryId = 'd16a26f8-40f6-4f69-a78e-42f5b9025900') LIMIT 1;",
parameters: {}
}

Steps to reproduce the issue

  1. Add book with author with name with apostrophe (directory has apostrophe in name)
  2. Scan library under the settings menu
  3. Click on the edit (pencil icon)
  4. Click on the match with the audible source
  5. Click on book from metadata list
  6. Book fails to update when author name has a apostrophe

Audiobookshelf version

v2.4.1

How are you running audiobookshelf?

Docker

Originally created by @alocklear on GitHub (Sep 10, 2023). ### Describe the issue Match of book when author name has an ' in the name fails to sequelize. Previously worked on older versions Below is server log. 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/Author.js:115:21) at async ApiRouter.createAuthorsAndSeriesForItemUpdate (/server/routers/ApiRouter.js:563:26) { name: 'SequelizeDatabaseError', parent: [Error: SQLITE_ERROR: near "Donnell": syntax error] { errno: 1, code: 'SQLITE_ERROR', sql: "SELECT `id`, `name`, `lastFirst`, `asin`, `description`, `imagePath`, `createdAt`, `updatedAt`, `libraryId` FROM `authors` AS `author` WHERE (name = 'Patrick K. O'Donnell' COLLATE NOCASE AND `author`.`libraryId` = 'd16a26f8-40f6-4f69-a78e-42f5b9025900') LIMIT 1;" }, original: [Error: SQLITE_ERROR: near "Donnell": syntax error] { errno: 1, code: 'SQLITE_ERROR', sql: "SELECT `id`, `name`, `lastFirst`, `asin`, `description`, `imagePath`, `createdAt`, `updatedAt`, `libraryId` FROM `authors` AS `author` WHERE (name = 'Patrick K. O'Donnell' COLLATE NOCASE AND `author`.`libraryId` = 'd16a26f8-40f6-4f69-a78e-42f5b9025900') LIMIT 1;" }, sql: "SELECT `id`, `name`, `lastFirst`, `asin`, `description`, `imagePath`, `createdAt`, `updatedAt`, `libraryId` FROM `authors` AS `author` WHERE (name = 'Patrick K. O'Donnell' COLLATE NOCASE AND `author`.`libraryId` = 'd16a26f8-40f6-4f69-a78e-42f5b9025900') LIMIT 1;", parameters: {} } ### Steps to reproduce the issue 1. Add book with author with name with apostrophe (directory has apostrophe in name) 2. Scan library under the settings menu 3. Click on the edit (pencil icon) 4. Click on the match with the audible source 5. Click on book from metadata list 6. Book fails to update when author name has a apostrophe ### Audiobookshelf version v2.4.1 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:41:09 +02:00
adam closed this issue 2026-04-24 23:41:09 +02:00
Author
Owner

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

Fixed in v2.4.2

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

No dependencies set.

Reference: starred/audiobookshelf#1360