[Bug]: Deleting the last episode in a playlist causes a server crash #1457

Closed
opened 2026-04-24 23:46:20 +02:00 by adam · 1 comment
Owner

Originally created by @agc93 on GitHub (Oct 13, 2023).

Describe the issue

When removing episodes from a podcast (in my case from the podcast episode list), if you remove an episode that is the last file in a playlist, the server crashes attempting to remove the playlist.

Error logs from server:

audiobookshelf_1  | [2023-10-13 13:36:49] INFO: [PodcastController] Removed 1 media progress for episode e12e7dac-e4c7-479a-85a6-3659045a6aa7
audiobookshelf_1  | [2023-10-13 13:36:49] INFO: [LibraryItem] Library item "4b61e649-4e73-4726-a719-ba3b2297453d" updated
audiobookshelf_1  | [2023-10-13 13:36:50] INFO: [PodcastController] Hard deleted episode file at "/podcasts/The Daily/The Writers’ Revolt Against A.I. Companies.mp3"
audiobookshelf_1  | /server/controllers/PodcastController.js:289
audiobookshelf_1  |         Logger.info(`[PodcastController] Playlist "${playlist.name}" has no more items - removing it`)
audiobookshelf_1  |                                                      ^
audiobookshelf_1  |
audiobookshelf_1  | ReferenceError: playlist is not defined
audiobookshelf_1  |     at ApiRouter.removeEpisode (/server/controllers/PodcastController.js:289:54)

Steps to reproduce the issue

  1. Create a playlist with multiple episodes in it
  2. Remove/delete those episodes from Audiobookshelf
  3. Server will crash when it attempts to clean up the empty playlist.

Audiobookshelf version

v2,4,4

How are you running audiobookshelf?

Docker

Originally created by @agc93 on GitHub (Oct 13, 2023). ### Describe the issue When removing episodes from a podcast (in my case from the podcast episode list), if you remove an episode that is the last file in a playlist, the server crashes attempting to remove the playlist. Error logs from server: ```text audiobookshelf_1 | [2023-10-13 13:36:49] INFO: [PodcastController] Removed 1 media progress for episode e12e7dac-e4c7-479a-85a6-3659045a6aa7 audiobookshelf_1 | [2023-10-13 13:36:49] INFO: [LibraryItem] Library item "4b61e649-4e73-4726-a719-ba3b2297453d" updated audiobookshelf_1 | [2023-10-13 13:36:50] INFO: [PodcastController] Hard deleted episode file at "/podcasts/The Daily/The Writers’ Revolt Against A.I. Companies.mp3" audiobookshelf_1 | /server/controllers/PodcastController.js:289 audiobookshelf_1 | Logger.info(`[PodcastController] Playlist "${playlist.name}" has no more items - removing it`) audiobookshelf_1 | ^ audiobookshelf_1 | audiobookshelf_1 | ReferenceError: playlist is not defined audiobookshelf_1 | at ApiRouter.removeEpisode (/server/controllers/PodcastController.js:289:54) ``` ### Steps to reproduce the issue 1. Create a playlist with multiple episodes in it 2. Remove/delete those episodes from Audiobookshelf 3. Server will crash when it attempts to clean up the empty playlist. ### Audiobookshelf version v2,4,4 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:46:20 +02:00
adam closed this issue 2026-04-24 23:46:20 +02:00
Author
Owner

@advplyr commented on GitHub (Oct 29, 2023):

Fixed in v2.5.0

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

No dependencies set.

Reference: starred/audiobookshelf#1457