[Bug]: duration column of books table not updated if null but audio files exist #2389

Open
opened 2026-04-25 00:06:42 +02:00 by adam · 1 comment
Owner

Originally created by @nichwall on GitHub (Dec 2, 2024).

What happened?

A record is able to have NULL in the duration column of the books table. I have a number of books originally added before the migration to SQLite in 2.3.x where the duration is NULL. The duration is shown correctly in the web client, and the duration for each file is included in the audioFiles column, which I assume is what is being used for the API.

When I manually scan the book individually, using "Re-Scan" in the edit modal, the duration column is correctly updated to have a numeric value instead of NULL. When scanning the entire library, the duration column is not updated and remains NULL.

What did you expect to happen?

duration column to be updated when performing a full library scan. This may be due to the book already being "up-to-date", so the duration column is not updated.

Steps to reproduce the issue

  1. Have a book from an old database where the duration column is NULL or a value that is easy to see the data change
  2. Scan library
  3. Observe duration column is not updated
  4. Scan individual book
  5. Observe duration column updated

Audiobookshelf version

v2.17.2

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

No response

Additional Notes

No response

Originally created by @nichwall on GitHub (Dec 2, 2024). ### What happened? A record is able to have `NULL` in the `duration` column of the `books` table. I have a number of books originally added before the migration to SQLite in `2.3.x` where the `duration` is NULL. The duration is shown correctly in the web client, and the duration for each file is included in the `audioFiles` column, which I assume is what is being used for the API. When I manually scan the book individually, using "Re-Scan" in the edit modal, the duration column is correctly updated to have a numeric value instead of `NULL`. When scanning the entire library, the duration column is not updated and remains `NULL`. ### What did you expect to happen? `duration` column to be updated when performing a full library scan. This may be due to the book already being "up-to-date", so the `duration` column is not updated. ### Steps to reproduce the issue 1. Have a book from an old database where the `duration` column is NULL or a value that is easy to see the data change 2. Scan library 3. Observe `duration` column is not updated 4. Scan individual book 5. Observe `duration` column updated ### Audiobookshelf version v2.17.2 ### 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 _No response_ ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:06:42 +02:00
Author
Owner

@nichwall commented on GitHub (Dec 2, 2024):

After additional testing, I misidentified the cause of the error. A library scan does update the row correctly if the files have been updated (causing the item to be scanned).

The bug is better characterized as needing to force scanning and updating the library item if the duration column is NULL but there are audioFiles defined.

@nichwall commented on GitHub (Dec 2, 2024): After additional testing, I misidentified the cause of the error. A library scan does update the row correctly if the files have been updated (causing the item to be scanned). The bug is better characterized as needing to force scanning and updating the library item if the `duration` column is NULL but there are `audioFiles` defined.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2389