[Bug]: Cannot mark book as finished #1660

Closed
opened 2026-04-24 23:53:50 +02:00 by adam · 11 comments
Owner

Originally created by @kymahi on GitHub (Jan 16, 2024).

Describe the issue

Somehow a downloaded book got out of sync, so I went to mark it as "finished" in the app first, then the web client. Both times I received an error, "Failed to mark as Finished".

Sometimes, in the web version, I get a socket error and it has to reconnect to a websocket.

2024-01-16 18:23:34.389

INFO

[LogManager] Init current daily log filename: 2024-01-16.txt

2024-01-16 18:23:34.493

INFO

[Watcher] Initializing watcher for "Audiobooks".

2024-01-16 18:23:34.493

DEBUG

[Watcher] Init watcher for library folder path "/audiobooks"

2024-01-16 18:23:34.494

INFO

[Watcher] Initializing watcher for "eBook Library Test".

2024-01-16 18:23:34.494

DEBUG

[Watcher] Init watcher for library folder path "/books"

2024-01-16 18:23:34.498

INFO

Listening on port :80

2024-01-16 18:23:35.102

INFO

[SocketAuthority] Socket Connected pgU7rkK3vcIqpU9NAAAB

2024-01-16 18:23:35.705

INFO

[SocketAuthority] Socket Connected PpZ3cxj8UZOb3dyZAAAD

2024-01-16 18:23:35.857

INFO

[SocketAuthority] Socket Connected 6BiJxUmzRj1Lw3-xAAAF

2024-01-16 18:23:37.608

INFO

[SocketAuthority] Unauth socket pgU7rkK3vcIqpU9NAAAB disconnected (Reason: transport close)

2024-01-16 18:23:43.287

ERROR

[SocketAuthority] Socket for user kymahi has no client

2024-01-16 18:23:43.299

DEBUG

[SocketAuthority] User Online kymahi

2024-01-16 18:23:43.483

DEBUG

[SocketAuthority] User Online kymahi

2024-01-16 18:23:44.695

INFO

[SocketAuthority] Socket Connected kpEEYtiN0ewOE27zAAAH

2024-01-16 18:23:45.256

INFO

[Watcher] "eBook Library Test" Ready

2024-01-16 18:23:45.550

DEBUG

[SocketAuthority] User Online kymahi

2024-01-16 18:23:45.701

DEBUG

[ApiCacheManager] count: 0 size: 0

2024-01-16 18:23:46.002

DEBUG

[ApiCacheManager] Cache miss: {"user":"kymahi","url":"/libraries"}

2024-01-16 18:23:56.927

INFO

[Watcher] "Audiobooks" Ready

Steps to reproduce the issue

  1. In app or in web client, go to book that is not finished in "Continue Listening"
  2. Click 3 dots
  3. Click "Mark as Finished"
  4. Confirm "OK" in the popup asking if you want to mark it as finished
  5. Observe error popup

Audiobookshelf version

2.7.1

How are you running audiobookshelf?

Docker

Originally created by @kymahi on GitHub (Jan 16, 2024). ### Describe the issue Somehow a downloaded book got out of sync, so I went to mark it as "finished" in the app first, then the web client. Both times I received an error, "Failed to mark as Finished". Sometimes, in the web version, I get a socket error and it has to reconnect to a websocket. ``` 2024-01-16 18:23:34.389 INFO [LogManager] Init current daily log filename: 2024-01-16.txt 2024-01-16 18:23:34.493 INFO [Watcher] Initializing watcher for "Audiobooks". 2024-01-16 18:23:34.493 DEBUG [Watcher] Init watcher for library folder path "/audiobooks" 2024-01-16 18:23:34.494 INFO [Watcher] Initializing watcher for "eBook Library Test". 2024-01-16 18:23:34.494 DEBUG [Watcher] Init watcher for library folder path "/books" 2024-01-16 18:23:34.498 INFO Listening on port :80 2024-01-16 18:23:35.102 INFO [SocketAuthority] Socket Connected pgU7rkK3vcIqpU9NAAAB 2024-01-16 18:23:35.705 INFO [SocketAuthority] Socket Connected PpZ3cxj8UZOb3dyZAAAD 2024-01-16 18:23:35.857 INFO [SocketAuthority] Socket Connected 6BiJxUmzRj1Lw3-xAAAF 2024-01-16 18:23:37.608 INFO [SocketAuthority] Unauth socket pgU7rkK3vcIqpU9NAAAB disconnected (Reason: transport close) 2024-01-16 18:23:43.287 ERROR [SocketAuthority] Socket for user kymahi has no client 2024-01-16 18:23:43.299 DEBUG [SocketAuthority] User Online kymahi 2024-01-16 18:23:43.483 DEBUG [SocketAuthority] User Online kymahi 2024-01-16 18:23:44.695 INFO [SocketAuthority] Socket Connected kpEEYtiN0ewOE27zAAAH 2024-01-16 18:23:45.256 INFO [Watcher] "eBook Library Test" Ready 2024-01-16 18:23:45.550 DEBUG [SocketAuthority] User Online kymahi 2024-01-16 18:23:45.701 DEBUG [ApiCacheManager] count: 0 size: 0 2024-01-16 18:23:46.002 DEBUG [ApiCacheManager] Cache miss: {"user":"kymahi","url":"/libraries"} 2024-01-16 18:23:56.927 INFO [Watcher] "Audiobooks" Ready ``` ### Steps to reproduce the issue 1. In app or in web client, go to book that is not finished in "Continue Listening" 2. Click 3 dots 3. Click "Mark as Finished" 4. Confirm "OK" in the popup asking if you want to mark it as finished 5. Observe error popup ### Audiobookshelf version 2.7.1 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:53:50 +02:00
adam closed this issue 2026-04-24 23:53:51 +02:00
Author
Owner

@nichwall commented on GitHub (Jan 16, 2024):

Does it work if you first "Remove Progress" on the book?

@nichwall commented on GitHub (Jan 16, 2024): Does it work if you first "Remove Progress" on the book?
Author
Owner

@kymahi commented on GitHub (Jan 16, 2024):

@nichwall Actually it looks like the exact same result. Disconnect/reconnect from socket and failed to update.

@kymahi commented on GitHub (Jan 16, 2024): @nichwall Actually it looks like the exact same result. Disconnect/reconnect from socket and failed to update.
Author
Owner

@nichwall commented on GitHub (Jan 16, 2024):

It's the same behavior when you press "Remove Progress", or the same behavior when you "Mark as Finished" after removing progress?

Did this used to work and stopped working for you, or is this a new install?

@nichwall commented on GitHub (Jan 16, 2024): It's the same behavior when you press "Remove Progress", or the same behavior when you "Mark as Finished" after removing progress? Did this used to work and stopped working for you, or is this a new install?
Author
Owner

@kymahi commented on GitHub (Jan 16, 2024):

Trying to "remove progress" exhibited the same behavior as when I tried to "mark as finished". The web socket disconnected, reconnected, and then the page reloaded and the progress remained at what it was (13%).

This used to work. This is a year+ old installation.

@kymahi commented on GitHub (Jan 16, 2024): Trying to "remove progress" exhibited the same behavior as when I tried to "mark as finished". The web socket disconnected, reconnected, and then the page reloaded and the progress remained at what it was (13%). This used to work. This is a year+ old installation.
Author
Owner

@advplyr commented on GitHub (Jan 16, 2024):

The server is most likely crashing and you are not seeing the error log of the previous container instance. If you can disable the auto-restart on your container that may be easier for you to catch the actual error.

@advplyr commented on GitHub (Jan 16, 2024): The server is most likely crashing and you are not seeing the error log of the previous container instance. If you can disable the auto-restart on your container that may be easier for you to catch the actual error.
Author
Owner

@kymahi commented on GitHub (Jan 17, 2024):

So you were correct. I turned off the auto-restart, and it crashed when attempting to "Mark as finished", but the logs are pretty much exactly the same. I'm not seeing any additional logs or anything like that. It just quits.

I'm beginning to think I need a fresh install. I'm finding more and more errors occurring with my server. I just found out that, on top of these errors, the backups have been failing since 2023/12/26. I have weeks of errors:

[BackupManager] Failed to unzip backup "/metadata/backups/2024-01-17T0100.audiobookshelf" Error: Bad archive

going back from today back to December 26th.

Is there a good way to keep user/listening data, and blow away everything else?

@kymahi commented on GitHub (Jan 17, 2024): So you were correct. I turned off the auto-restart, and it crashed when attempting to "Mark as finished", but the logs are pretty much exactly the same. I'm not seeing any additional logs or anything like that. It just quits. I'm beginning to think I need a fresh install. I'm finding more and more errors occurring with my server. I just found out that, on top of these errors, the backups have been failing since 2023/12/26. I have weeks of errors: `[BackupManager] Failed to unzip backup "/metadata/backups/2024-01-17T0100.audiobookshelf" Error: Bad archive` going back from today back to December 26th. Is there a good way to keep user/listening data, and blow away everything else?
Author
Owner

@advplyr commented on GitHub (Jan 17, 2024):

If there is a crash there must be an error but I'm not sure where you are looking at logs. If you look at the logs from the container it should have a crash error.

@advplyr commented on GitHub (Jan 17, 2024): If there is a crash there must be an error but I'm not sure where you are looking at logs. If you look at the logs from the container it should have a crash error.
Author
Owner

@kymahi commented on GitHub (Jan 17, 2024):

Got the Docker logs

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.upsert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:341:12)
    at async Function.upsert (/node_modules/sequelize/lib/model.js:1533:20)
    at async ApiRouter.createUpdateMediaProgress (/server/controllers/MeController.js:70:26) {
  name: 'SequelizeDatabaseError',
  parent: [Error: SQLITE_CORRUPT: database disk image is malformed] {
    errno: 11,
    code: 'SQLITE_CORRUPT',
    sql: 'INSERT INTO `mediaProgresses` (`id`,`mediaItemId`,`mediaItemType`,`duration`,`currentTime`,`isFinished`,`hideFromContinueListening`,`ebookLocation`,`ebookProgress`,`finishedAt`,`extraData`,`createdAt`,`updatedAt`,`userId`) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) ON CONFLICT (`id`) DO UPDATE SET `id`=EXCLUDED.`id`,`userId`=EXCLUDED.`userId`,`mediaItemId`=EXCLUDED.`mediaItemId`,`mediaItemType`=EXCLUDED.`mediaItemType`,`duration`=EXCLUDED.`duration`,`currentTime`=EXCLUDED.`currentTime`,`ebookLocation`=EXCLUDED.`ebookLocation`,`ebookProgress`=EXCLUDED.`ebookProgress`,`isFinished`=EXCLUDED.`isFinished`,`hideFromContinueListening`=EXCLUDED.`hideFromContinueListening`,`finishedAt`=EXCLUDED.`finishedAt`,`createdAt`=EXCLUDED.`createdAt`,`updatedAt`=EXCLUDED.`updatedAt`,`extraData`=EXCLUDED.`extraData`;'
  },
  original: [Error: SQLITE_CORRUPT: database disk image is malformed] {
    errno: 11,
    code: 'SQLITE_CORRUPT',
    sql: 'INSERT INTO `mediaProgresses` (`id`,`mediaItemId`,`mediaItemType`,`duration`,`currentTime`,`isFinished`,`hideFromContinueListening`,`ebookLocation`,`ebookProgress`,`finishedAt`,`extraData`,`createdAt`,`updatedAt`,`userId`) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) ON CONFLICT (`id`) DO UPDATE SET `id`=EXCLUDED.`id`,`userId`=EXCLUDED.`userId`,`mediaItemId`=EXCLUDED.`mediaItemId`,`mediaItemType`=EXCLUDED.`mediaItemType`,`duration`=EXCLUDED.`duration`,`currentTime`=EXCLUDED.`currentTime`,`ebookLocation`=EXCLUDED.`ebookLocation`,`ebookProgress`=EXCLUDED.`ebookProgress`,`isFinished`=EXCLUDED.`isFinished`,`hideFromContinueListening`=EXCLUDED.`hideFromContinueListening`,`finishedAt`=EXCLUDED.`finishedAt`,`createdAt`=EXCLUDED.`createdAt`,`updatedAt`=EXCLUDED.`updatedAt`,`extraData`=EXCLUDED.`extraData`;'
  },
  sql: 'INSERT INTO `mediaProgresses` (`id`,`mediaItemId`,`mediaItemType`,`duration`,`currentTime`,`isFinished`,`hideFromContinueListening`,`ebookLocation`,`ebookProgress`,`finishedAt`,`extraData`,`createdAt`,`updatedAt`,`userId`) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) ON CONFLICT (`id`) DO UPDATE SET `id`=EXCLUDED.`id`,`userId`=EXCLUDED.`userId`,`mediaItemId`=EXCLUDED.`mediaItemId`,`mediaItemType`=EXCLUDED.`mediaItemType`,`duration`=EXCLUDED.`duration`,`currentTime`=EXCLUDED.`currentTime`,`ebookLocation`=EXCLUDED.`ebookLocation`,`ebookProgress`=EXCLUDED.`ebookProgress`,`isFinished`=EXCLUDED.`isFinished`,`hideFromContinueListening`=EXCLUDED.`hideFromContinueListening`,`finishedAt`=EXCLUDED.`finishedAt`,`createdAt`=EXCLUDED.`createdAt`,`updatedAt`=EXCLUDED.`updatedAt`,`extraData`=EXCLUDED.`extraData`;',
  parameters: {}
}
@kymahi commented on GitHub (Jan 17, 2024): Got the Docker logs ``` 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.upsert (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:341:12) at async Function.upsert (/node_modules/sequelize/lib/model.js:1533:20) at async ApiRouter.createUpdateMediaProgress (/server/controllers/MeController.js:70:26) { name: 'SequelizeDatabaseError', parent: [Error: SQLITE_CORRUPT: database disk image is malformed] { errno: 11, code: 'SQLITE_CORRUPT', sql: 'INSERT INTO `mediaProgresses` (`id`,`mediaItemId`,`mediaItemType`,`duration`,`currentTime`,`isFinished`,`hideFromContinueListening`,`ebookLocation`,`ebookProgress`,`finishedAt`,`extraData`,`createdAt`,`updatedAt`,`userId`) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) ON CONFLICT (`id`) DO UPDATE SET `id`=EXCLUDED.`id`,`userId`=EXCLUDED.`userId`,`mediaItemId`=EXCLUDED.`mediaItemId`,`mediaItemType`=EXCLUDED.`mediaItemType`,`duration`=EXCLUDED.`duration`,`currentTime`=EXCLUDED.`currentTime`,`ebookLocation`=EXCLUDED.`ebookLocation`,`ebookProgress`=EXCLUDED.`ebookProgress`,`isFinished`=EXCLUDED.`isFinished`,`hideFromContinueListening`=EXCLUDED.`hideFromContinueListening`,`finishedAt`=EXCLUDED.`finishedAt`,`createdAt`=EXCLUDED.`createdAt`,`updatedAt`=EXCLUDED.`updatedAt`,`extraData`=EXCLUDED.`extraData`;' }, original: [Error: SQLITE_CORRUPT: database disk image is malformed] { errno: 11, code: 'SQLITE_CORRUPT', sql: 'INSERT INTO `mediaProgresses` (`id`,`mediaItemId`,`mediaItemType`,`duration`,`currentTime`,`isFinished`,`hideFromContinueListening`,`ebookLocation`,`ebookProgress`,`finishedAt`,`extraData`,`createdAt`,`updatedAt`,`userId`) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) ON CONFLICT (`id`) DO UPDATE SET `id`=EXCLUDED.`id`,`userId`=EXCLUDED.`userId`,`mediaItemId`=EXCLUDED.`mediaItemId`,`mediaItemType`=EXCLUDED.`mediaItemType`,`duration`=EXCLUDED.`duration`,`currentTime`=EXCLUDED.`currentTime`,`ebookLocation`=EXCLUDED.`ebookLocation`,`ebookProgress`=EXCLUDED.`ebookProgress`,`isFinished`=EXCLUDED.`isFinished`,`hideFromContinueListening`=EXCLUDED.`hideFromContinueListening`,`finishedAt`=EXCLUDED.`finishedAt`,`createdAt`=EXCLUDED.`createdAt`,`updatedAt`=EXCLUDED.`updatedAt`,`extraData`=EXCLUDED.`extraData`;' }, sql: 'INSERT INTO `mediaProgresses` (`id`,`mediaItemId`,`mediaItemType`,`duration`,`currentTime`,`isFinished`,`hideFromContinueListening`,`ebookLocation`,`ebookProgress`,`finishedAt`,`extraData`,`createdAt`,`updatedAt`,`userId`) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) ON CONFLICT (`id`) DO UPDATE SET `id`=EXCLUDED.`id`,`userId`=EXCLUDED.`userId`,`mediaItemId`=EXCLUDED.`mediaItemId`,`mediaItemType`=EXCLUDED.`mediaItemType`,`duration`=EXCLUDED.`duration`,`currentTime`=EXCLUDED.`currentTime`,`ebookLocation`=EXCLUDED.`ebookLocation`,`ebookProgress`=EXCLUDED.`ebookProgress`,`isFinished`=EXCLUDED.`isFinished`,`hideFromContinueListening`=EXCLUDED.`hideFromContinueListening`,`finishedAt`=EXCLUDED.`finishedAt`,`createdAt`=EXCLUDED.`createdAt`,`updatedAt`=EXCLUDED.`updatedAt`,`extraData`=EXCLUDED.`extraData`;', parameters: {} } ```
Author
Owner

@advplyr commented on GitHub (Jan 17, 2024):

How were you mounting the /config folder? On a network drive?

@advplyr commented on GitHub (Jan 17, 2024): How were you mounting the `/config` folder? On a network drive?
Author
Owner

@kymahi commented on GitHub (Jan 17, 2024):

An external USB HDD

@kymahi commented on GitHub (Jan 17, 2024): An external USB HDD
Author
Owner

@advplyr commented on GitHub (Jan 17, 2024):

You'll have to revert to the last successful backup. I'm not sure how/why the database got corrupted

@advplyr commented on GitHub (Jan 17, 2024): You'll have to revert to the last successful backup. I'm not sure how/why the database got corrupted
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1660