Jellyfin doesn't remove library items if their previously used directory is empty #6498

Closed
opened 2026-02-07 03:43:36 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @alvitali on GitHub (Nov 20, 2024).

This issue respects the following points:

  • This is a bug, not a question or a configuration issue; Please visit our forum or chat rooms first to troubleshoot with volunteers, before creating a report. The links can be found here.
  • This issue is not already reported on GitHub (I've searched it).
  • I'm using an up to date version of Jellyfin Server stable, unstable or master; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue.
  • I agree to follow Jellyfin's Code of Conduct.
  • This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.

Description of the bug

When removing or moving all items from a library's folder, Jellyfin skips over the empty directory, leaving all the library items in the database after scanning the library. If items were moved to another folder, they all show up as duplicates, with one file unplayable as it doesn't exist at the specified path.

Reproduction steps

  1. Move or delete all folders / items from a given library path that's in use
  2. Trigger a library scan
  3. Jellyfin skips the empty directory on library scans, still showing the (inexistent) items in the library

What is the current bug behavior?

On subsequent library scans, Jellyfin just skips scanning the empty directory. If the files were moved to another path in the same library, all the library items are duplicated - with one copy that's unplayable as those files do not exist where Jellyfin is looking for them.

What is the expected correct behavior?

Scan and update the library database regardless of whether a directory is empty or not. Maybe differentiate between empty (accessible) directories and unaccessible directories, so in case of lost connection to network shares the entire library isn't deleted.

Jellyfin Server version

10.10.0+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.10.3

Environment

- OS: Debian
- Linux Kernel: 6.1
- Virtualization: Docker
- Clients: Browser
- Browser: Chromium, Webkit
- FFmpeg Version: default
- Playback Method: -
- Hardware Acceleration: -
- GPU Model: -
- Plugins: IntroSkipper, InfuseSync
- Reverse Proxy: Traefik
- Base URL: none
- Networking: Bridge
- Storage: NFS mounted share

Jellyfin logs

[2024-11-20 14:31:07.166 +01:00] [INF] [15] Emby.Server.Implementations.Library.LibraryManager: Validating media library
[2024-11-20 14:31:07.885 +01:00] [WRN] [15] MediaBrowser.Controller.Entities.BaseItem: Library folder "/media-directory/movies/mid" is inaccessible or empty, skipping

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

Originally created by @alvitali on GitHub (Nov 20, 2024). ### This issue respects the following points: - [x] This is a **bug**, not a question or a configuration issue; Please visit our forum or chat rooms first to troubleshoot with volunteers, before creating a report. The links can be found [here](https://jellyfin.org/contact/). - [x] This issue is **not** already reported on [GitHub](https://github.com/jellyfin/jellyfin/issues?q=is%3Aopen+is%3Aissue) _(I've searched it)_. - [x] I'm using an up to date version of Jellyfin Server stable, unstable or master; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue. - [x] I agree to follow Jellyfin's [Code of Conduct](https://jellyfin.org/docs/general/community-standards.html#code-of-conduct). - [x] This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one. ### Description of the bug When removing or moving all items from a library's folder, Jellyfin skips over the empty directory, leaving all the library items in the database after scanning the library. If items were moved to another folder, they all show up as duplicates, with one file unplayable as it doesn't exist at the specified path. ### Reproduction steps 1. Move or delete all folders / items from a given library path that's in use 2. Trigger a library scan 3. Jellyfin skips the empty directory on library scans, still showing the (inexistent) items in the library ### What is the current _bug_ behavior? On subsequent library scans, Jellyfin just skips scanning the empty directory. If the files were moved to another path in the same library, all the library items are duplicated - with one copy that's unplayable as those files do not exist where Jellyfin is looking for them. ### What is the expected _correct_ behavior? Scan and update the library database regardless of whether a directory is empty or not. Maybe differentiate between empty (accessible) directories and unaccessible directories, so in case of lost connection to network shares the entire library isn't deleted. ### Jellyfin Server version 10.10.0+ ### Specify commit id _No response_ ### Specify unstable release number _No response_ ### Specify version number _No response_ ### Specify the build version 10.10.3 ### Environment ```markdown - OS: Debian - Linux Kernel: 6.1 - Virtualization: Docker - Clients: Browser - Browser: Chromium, Webkit - FFmpeg Version: default - Playback Method: - - Hardware Acceleration: - - GPU Model: - - Plugins: IntroSkipper, InfuseSync - Reverse Proxy: Traefik - Base URL: none - Networking: Bridge - Storage: NFS mounted share ``` ### Jellyfin logs ```shell [2024-11-20 14:31:07.166 +01:00] [INF] [15] Emby.Server.Implementations.Library.LibraryManager: Validating media library [2024-11-20 14:31:07.885 +01:00] [WRN] [15] MediaBrowser.Controller.Entities.BaseItem: Library folder "/media-directory/movies/mid" is inaccessible or empty, skipping ``` ### FFmpeg logs ```shell ``` ### Client / Browser logs _No response_ ### Relevant screenshots or videos _No response_ ### Additional information _No response_
OVERLORD added the bug label 2026-02-07 03:43:36 +03:00
Author
Owner

@gnattu commented on GitHub (Nov 20, 2024):

This is a design choice and you can see the explanation here: https://github.com/jellyfin/jellyfin/issues/12297#issuecomment-2370111919

Closing as duplicated.

@gnattu commented on GitHub (Nov 20, 2024): This is a design choice and you can see the explanation here: https://github.com/jellyfin/jellyfin/issues/12297#issuecomment-2370111919 Closing as duplicated.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#6498