[Bug]: Crash when updating series sequence #1249

Closed
opened 2026-04-24 23:37:28 +02:00 by adam · 6 comments
Owner

Originally created by @YodaDaCoda on GitHub (Jul 17, 2023).

Describe the issue

From the series view, I tried to edit a book's metadata (adding a series number to a book that was missing it). Upon clicking 'Save' I get a red toast saying "Socket disconnected" and an error in the logs, then the server crashes (and the container reboots).

audiobookshelf    | [2023-07-17 12:04:29] DEBUG: [BookMetadata] Key updated series [
audiobookshelf    |   {
audiobookshelf    |     displayName: 'Cradle #2',
audiobookshelf    |     id: '3a1118d2-0b5e-46b7-bac3-5e1096e1ad78',
audiobookshelf    |     name: 'Cradle',
audiobookshelf    |     sequence: '2'
audiobookshelf    |   }
audiobookshelf    | ] (BookMetadata.js:211)
audiobookshelf    | [2023-07-17 12:04:29] DEBUG: [LibraryItemController] Updated library item media 2 Soulsmith (LibraryItemController.js:144)
audiobookshelf    | /node_modules/sequelize/lib/model.js:2413
audiobookshelf    |         throw new Error("You attempted to save an instance with no primary key, this is not allowed since it would result in a global update");
audiobookshelf    |               ^
audiobookshelf    |
audiobookshelf    | Error: You attempted to save an instance with no primary key, this is not allowed since it would result in a global update
audiobookshelf    |     at BookSeries.save (/node_modules/sequelize/lib/model.js:2413:15)
audiobookshelf    |     at BookSeries.update (/node_modules/sequelize/lib/model.js:2598:23)
audiobookshelf    |     at Function.fullUpdateFromOld (/server/models/LibraryItem.js:223:52)
audiobookshelf    |     at async ApiRouter.updateMedia (/server/controllers/LibraryItemController.js:145:7)

Steps to reproduce the issue

I haven't tried to reproduce on other series/views.

  1. Open the Series view for a series
  2. Click the pencil icon to edit book details
  3. Hover over the Series entry and click the pencil icon to edit
  4. Add a series number to the book
  5. Press 'Submit'
  6. Press 'Save' <- error occurs

Audiobookshelf version

v2.3.1

This also occurred on v2.3.0, but I didn't check earlier versions.

How are you running audiobookshelf?

Docker

Originally created by @YodaDaCoda on GitHub (Jul 17, 2023). ### Describe the issue From the series view, I tried to edit a book's metadata (adding a series number to a book that was missing it). Upon clicking 'Save' I get a red toast saying "Socket disconnected" and an error in the logs, then the server crashes (and the container reboots). ``` audiobookshelf | [2023-07-17 12:04:29] DEBUG: [BookMetadata] Key updated series [ audiobookshelf | { audiobookshelf | displayName: 'Cradle #2', audiobookshelf | id: '3a1118d2-0b5e-46b7-bac3-5e1096e1ad78', audiobookshelf | name: 'Cradle', audiobookshelf | sequence: '2' audiobookshelf | } audiobookshelf | ] (BookMetadata.js:211) audiobookshelf | [2023-07-17 12:04:29] DEBUG: [LibraryItemController] Updated library item media 2 Soulsmith (LibraryItemController.js:144) audiobookshelf | /node_modules/sequelize/lib/model.js:2413 audiobookshelf | throw new Error("You attempted to save an instance with no primary key, this is not allowed since it would result in a global update"); audiobookshelf | ^ audiobookshelf | audiobookshelf | Error: You attempted to save an instance with no primary key, this is not allowed since it would result in a global update audiobookshelf | at BookSeries.save (/node_modules/sequelize/lib/model.js:2413:15) audiobookshelf | at BookSeries.update (/node_modules/sequelize/lib/model.js:2598:23) audiobookshelf | at Function.fullUpdateFromOld (/server/models/LibraryItem.js:223:52) audiobookshelf | at async ApiRouter.updateMedia (/server/controllers/LibraryItemController.js:145:7) ``` ### Steps to reproduce the issue I haven't tried to reproduce on other series/views. 1. Open the Series view for a series 2. Click the pencil icon to edit book details 3. Hover over the Series entry and click the pencil icon to edit 4. Add a series number to the book 5. Press 'Submit' 6. Press 'Save' <- error occurs ### Audiobookshelf version v2.3.1 This also occurred on v2.3.0, but I didn't check earlier versions. ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:37:28 +02:00
adam closed this issue 2026-04-24 23:37:28 +02:00
Author
Owner

@bebopjunky commented on GitHub (Jul 17, 2023):

This happened to me as well

@bebopjunky commented on GitHub (Jul 17, 2023): This happened to me as well
Author
Owner

@Nab0y commented on GitHub (Jul 17, 2023):

Confirmed:

ver. 2.3.1

  1. Added a new book, and it appeared in the "Recently Added" section.
  2. Submitted the book for editing for the first time, and everything is fine.
  3. Applied the changes made, including the series number and reader, and everything is still fine.
  4. Submitted the book for editing again from the same "Recently Added" section, and the server crashed, causing Docker to stop. There are no logs available for the data.

Logs selected between crush and docker start:
image

@Nab0y commented on GitHub (Jul 17, 2023): Confirmed: ver. 2.3.1 1. Added a new book, and it appeared in the "Recently Added" section. 2. Submitted the book for editing for the first time, and everything is fine. 3. Applied the changes made, including the series number and reader, and everything is still fine. 4. Submitted the book for editing again from the same "Recently Added" section, and the server crashed, causing Docker to stop. There are no logs available for the data. Logs selected between crush and docker start: ![image](https://github.com/advplyr/audiobookshelf/assets/13904687/a02e7675-01ab-4923-8b84-1b7864ef9442)
Author
Owner

@Nab0y commented on GitHub (Jul 17, 2023):

I think I have found the crash logs.

image

@Nab0y commented on GitHub (Jul 17, 2023): I think I have found the crash logs. ![image](https://github.com/advplyr/audiobookshelf/assets/13904687/d4149fc9-78c5-493b-8a67-c9c8cdf22619)
Author
Owner

@warwolf commented on GitHub (Jul 17, 2023):

I can add a bit to this.

While updating from Audible every normal book works fine even if i cannot update manually.
However if the book got a sequence range ex for book 1-5 it crashes when update from Audible.

@warwolf commented on GitHub (Jul 17, 2023): I can add a bit to this. While updating from Audible every normal book works fine even if i cannot update manually. However if the book got a sequence range ex for book 1-5 it crashes when update from Audible.
Author
Owner

@advplyr commented on GitHub (Jul 17, 2023):

Got this one. I'll put out another small patch later today.

@advplyr commented on GitHub (Jul 17, 2023): Got this one. I'll put out another small patch later today.
Author
Owner

@advplyr commented on GitHub (Jul 18, 2023):

Fixed in v2.3.2

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

No dependencies set.

Reference: starred/audiobookshelf#1249