[Bug]: Server crash on updating excluded prefixes #2727

Closed
opened 2026-04-25 00:09:57 +02:00 by adam · 2 comments
Owner

Originally created by @EugenVau on GitHub (Apr 24, 2025).

What happened?

The audiobookshelf docker container crashes after editing the list of excluded prefixes on the settings page.

What did you expect to happen?

No crash after editing the excluded prefixes.

Steps to reproduce the issue

  1. Log in as root user
  2. Go to settings page
  3. Edit the list in the input field for "Prefixes to Ignore (case insensitive)" - add or delete one or more prefixes. In my case I deleted the german articles "der, die, das" that I had added before filling the library.
  4. Press the "Save" button
  5. Try to navigate to some other page of audiobookshelf
  6. Reload the page (F5)

Audiobookshelf version

v2.20.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?

None

Logs

[2025-04-24 18:57:49.609] FATAL: [Server] Unhandled rejection: 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.bulkInsert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:346:21)
    at async recursiveBulkCreate (/node_modules/sequelize/lib/model.js:1697:25)
    at async series.bulkCreate (/node_modules/sequelize/lib/model.js:1786:12)
    at async ApiRouter.updateSortingPrefixes (/server/controllers/MiscController.js:234:7) {
  name: 'SequelizeUniqueConstraintError',
  errors: [
    ValidationErrorItem {
      message: 'id must be unique',
      type: 'unique violation',
      path: 'id',
      value: null,
      origin: 'DB',
      instance: null,
      validatorKey: 'not_unique',
      validatorName: null,
      validatorArgs: []
    }
  ],
  parent: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] {
    errno: 19,
    code: 'SQLITE_CONSTRAINT',
    sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;"
  },
  original: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] {
    errno: 19,
    code: 'SQLITE_CONSTRAINT',
    sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;"
  },
  fields: [ 'id' ],
  sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;"
} 
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.bulkInsert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:346:21)
      at async recursiveBulkCreate (/node_modules/sequelize/lib/model.js:1697:25)
      at async series.bulkCreate (/node_modules/sequelize/lib/model.js:1786:12)
      at async ApiRouter.updateSortingPrefixes (/server/controllers/MiscController.js:234:7) {
    name: 'SequelizeUniqueConstraintError',
    errors: [ [ValidationErrorItem] ],
    parent: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] {
      errno: 19,
      code: 'SQLITE_CONSTRAINT',
      sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;"
    },
    original: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] {
      errno: 19,
      code: 'SQLITE_CONSTRAINT',
      sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;"
    },
    fields: [ 'id' ],
    sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;"
  }
}

Additional Notes

The crash is reproducible every time you edit the prefixes list. After a restart of the container you can see that the list was updated.

Originally created by @EugenVau on GitHub (Apr 24, 2025). ### What happened? The audiobookshelf docker container crashes after editing the list of excluded prefixes on the settings page. ### What did you expect to happen? No crash after editing the excluded prefixes. ### Steps to reproduce the issue 1. Log in as root user 2. Go to settings page 3. Edit the list in the input field for "Prefixes to Ignore (case insensitive)" - add or delete one or more prefixes. In my case I deleted the german articles "der, die, das" that I had added before filling the library. 4. Press the "Save" button 5. Try to navigate to some other page of audiobookshelf 6. Reload the page (F5) ### Audiobookshelf version v2.20.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? None ### Logs ```shell [2025-04-24 18:57:49.609] FATAL: [Server] Unhandled rejection: 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.bulkInsert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:346:21) at async recursiveBulkCreate (/node_modules/sequelize/lib/model.js:1697:25) at async series.bulkCreate (/node_modules/sequelize/lib/model.js:1786:12) at async ApiRouter.updateSortingPrefixes (/server/controllers/MiscController.js:234:7) { name: 'SequelizeUniqueConstraintError', errors: [ ValidationErrorItem { message: 'id must be unique', type: 'unique violation', path: 'id', value: null, origin: 'DB', instance: null, validatorKey: 'not_unique', validatorName: null, validatorArgs: [] } ], parent: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] { errno: 19, code: 'SQLITE_CONSTRAINT', sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;" }, original: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] { errno: 19, code: 'SQLITE_CONSTRAINT', sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;" }, fields: [ 'id' ], sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;" } 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.bulkInsert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:346:21) at async recursiveBulkCreate (/node_modules/sequelize/lib/model.js:1697:25) at async series.bulkCreate (/node_modules/sequelize/lib/model.js:1786:12) at async ApiRouter.updateSortingPrefixes (/server/controllers/MiscController.js:234:7) { name: 'SequelizeUniqueConstraintError', errors: [ [ValidationErrorItem] ], parent: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] { errno: 19, code: 'SQLITE_CONSTRAINT', sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;" }, original: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: series.id] { errno: 19, code: 'SQLITE_CONSTRAINT', sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;" }, fields: [ 'id' ], sql: "INSERT INTO `series` (`id`,`nameIgnorePrefix`,`createdAt`,`updatedAt`) VALUES ('901c16d6-66f5-4d38-956b-121746a1aee1','Der kleine Drache Kokosnuss - Sachhörbuch','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('20ae0a57-f35c-4d25-8105-c2c0268a81e6','Der kleine Drache Kokosnuss','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00'),('c3586088-695d-465d-b395-6f1b1a739789','Das Känguru','2025-04-24 16:57:49.605 +00:00','2025-04-24 16:57:49.605 +00:00') ON CONFLICT (`name`,`libraryId`) DO UPDATE SET `nameIgnorePrefix`=EXCLUDED.`nameIgnorePrefix`;" } } ``` ### Additional Notes The crash is reproducible every time you edit the prefixes list. After a restart of the container you can see that the list was updated.
adam added the bug label 2026-04-25 00:09:57 +02:00
adam closed this issue 2026-04-25 00:09:57 +02:00
Author
Owner

@advplyr commented on GitHub (Apr 28, 2025):

Additional detail when reproducing this:
The prefix has to belong to a series name to cause the crash.

@advplyr commented on GitHub (Apr 28, 2025): Additional detail when reproducing this: The prefix has to belong to a series name to cause the crash.
Author
Owner

@github-actions[bot] commented on GitHub (May 15, 2025):

Fixed in v2.22.0.

@github-actions[bot] commented on GitHub (May 15, 2025): Fixed in [v2.22.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.22.0).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2727