[Bug]: Some Library Stats API values report null for empty libraries #2746

Closed
opened 2026-04-25 00:10:11 +02:00 by adam · 1 comment
Owner

Originally created by @nickthomsonciq on GitHub (May 2, 2025).

What happened?

I noticed the HASS integration for AudioBookshelf was reporting errors, and after tracking it down I discovered it was because the totalSize parameter of api/libraries/library-id/stats for an empty library was null. Additionally totalDuration and numAudioTracks was also null. Given other numeric values in the stats are set to 0, I would assume these three should be as well.

What did you expect to happen?

totalSize, totalDuration and numAudioTracks should be 0 for empty libraries.

Steps to reproduce the issue

  1. Create an empty library
  2. Invoke api/libraries/library-id/stats
  3. View the result

Audiobookshelf version

v2.21.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


Additional Notes

No response

Originally created by @nickthomsonciq on GitHub (May 2, 2025). ### What happened? I noticed the HASS integration for AudioBookshelf was reporting errors, and after tracking it down I discovered it was because the totalSize parameter of api/libraries/library-id/stats for an empty library was null. Additionally totalDuration and numAudioTracks was also null. Given other numeric values in the stats are set to 0, I would assume these three should be as well. ### What did you expect to happen? totalSize, totalDuration and numAudioTracks should be 0 for empty libraries. ### Steps to reproduce the issue 1. Create an empty library 2. Invoke api/libraries/library-id/stats 3. View the result ### Audiobookshelf version v2.21.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 ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:10:11 +02:00
adam closed this issue 2026-04-25 00:10:11 +02:00
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#2746