Adding movies to collections broken in 10.11 #7002

Closed
opened 2026-02-07 04:23:09 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @theguymadmax on GitHub (May 11, 2025).

Description of the bug

Adding movies to collections broken in 10.11. Neither by enabling "Automatically add to collection" or by using the the TMBD Boxset plugin in works.

Scenario 1 seems to be regression from: #13827

Reproduction steps

Scenario 1:

  1. Setup an 10.11 server instance
  2. Scan in movie library and enable "Automatically add to collection"
  3. Run Scan Media Library

Scenario 2:

  1. Setup an 10.11 server instance
  2. Scan in movie library
  3. Install the TMDb Box Sets
  4. Run the Scan library for new box sets

What is the current bug behavior?

Both situations leads to no creation of collections/boxsets.

What is the expected correct behavior?

Collections are created.

Jellyfin Server version

Master

Specify commit id

a7bb3ea214

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.11 (Master)

Environment

- OS:Windows 11
- FFmpeg Version: 7.1.1-3 (GH Artifact)
- Plugins: TMDb Box Sets 11.2505.8.0

Jellyfin logs

[2025-05-10 19:34:06.834 -04:00] [INF] [20] Jellyfin.Plugin.TMDbBoxSets.ScheduledTasks.RefreshLibraryTask: Starting TMDbBoxSets refresh library task
[2025-05-10 19:34:06.970 -04:00] [INF] [20] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Found 0 TMDb collection(s) across all movies
[2025-05-10 19:34:06.971 -04:00] [INF] [20] Jellyfin.Plugin.TMDbBoxSets.ScheduledTasks.RefreshLibraryTask: TMDbBoxSets refresh library task finished
[2025-05-10 19:34:06.971 -04:00] [INF] [20] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan library for new box sets" Completed after 0 minute(s) and 0 seconds

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

Originally created by @theguymadmax on GitHub (May 11, 2025). ### Description of the bug Adding movies to collections broken in 10.11. Neither by enabling "Automatically add to collection" or by using the the TMBD Boxset plugin in works. Scenario 1 seems to be regression from: #13827 ### Reproduction steps Scenario 1: 1. Setup an 10.11 server instance 2. Scan in movie library and enable "Automatically add to collection" 3. Run Scan Media Library Scenario 2: 1. Setup an 10.11 server instance 2. Scan in movie library 3. Install the TMDb Box Sets 4. Run the Scan library for new box sets ### What is the current _bug_ behavior? Both situations leads to no creation of collections/boxsets. ### What is the expected _correct_ behavior? Collections are created. ### Jellyfin Server version Master ### Specify commit id a7bb3ea21489a3a4c9a3e9f60c9521eaa84bad31 ### Specify unstable release number _No response_ ### Specify version number _No response_ ### Specify the build version 10.11 (Master) ### Environment ```markdown - OS:Windows 11 - FFmpeg Version: 7.1.1-3 (GH Artifact) - Plugins: TMDb Box Sets 11.2505.8.0 ``` ### Jellyfin logs ```shell [2025-05-10 19:34:06.834 -04:00] [INF] [20] Jellyfin.Plugin.TMDbBoxSets.ScheduledTasks.RefreshLibraryTask: Starting TMDbBoxSets refresh library task [2025-05-10 19:34:06.970 -04:00] [INF] [20] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Found 0 TMDb collection(s) across all movies [2025-05-10 19:34:06.971 -04:00] [INF] [20] Jellyfin.Plugin.TMDbBoxSets.ScheduledTasks.RefreshLibraryTask: TMDbBoxSets refresh library task finished [2025-05-10 19:34:06.971 -04:00] [INF] [20] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan library for new box sets" Completed after 0 minute(s) and 0 seconds ``` ### 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 04:23:09 +03:00
Author
Owner

@allesmi commented on GitHub (May 12, 2025):

I have investigated this bug a bit but I am not sure if I can provide a fix in reasonable time. Maybe someone else can save some time on debugging with this information. I do not have in-depth understanding of the code, please correct me if something is wrong.

The collections should be created/added in the method MediaBrowser.Controller.Library.ILibraryManager.GetItemList. There is call to the Library Manager that returns 0 movies even though there should be some (tested with a fresh library consisting of four movies that should be part of the same collection). Digging deeper into the code here results in this query to Sqlite:

SELECT "b5"."Id", "b5"."Album", "b5"."AlbumArtists", "b5"."Artists", "b5"."Audio", "b5"."ChannelId", "b5"."CleanName", "b5"."CommunityRating", "b5"."CriticRating", "b5"."CustomRating", "b5"."Data", "b5"."DateCreated", "b5"."DateLastMediaAdded", "b5"."DateLastRefreshed", "b5"."DateLastSaved", "b5"."DateModified", "b5"."EndDate", "b5"."EpisodeTitle", "b5"."ExternalId", "b5"."ExternalSeriesId", "b5"."ExternalServiceId", "b5"."ExtraIds", "b5"."ExtraType", "b5"."ForcedSortName", "b5"."Genres", "b5"."Height", "b5"."IndexNumber", "b5"."InheritedParentalRatingSubValue", "b5"."InheritedParentalRatingValue", "b5"."IsFolder", "b5"."IsInMixedFolder", "b5"."IsLocked", "b5"."IsMovie", "b5"."IsRepeat", "b5"."IsSeries", "b5"."IsVirtualItem", "b5"."LUFS", "b5"."MediaType", "b5"."Name", "b5"."NormalizationGain", "b5"."OfficialRating", "b5"."OriginalTitle", "b5"."Overview", "b5"."OwnerId", "b5"."ParentId", "b5"."ParentIndexNumber", "b5"."Path", "b5"."PreferredMetadataCountryCode", "b5"."PreferredMetadataLanguage", "b5"."PremiereDate", "b5"."PresentationUniqueKey", "b5"."PrimaryVersionId", "b5"."ProductionLocations", "b5"."ProductionYear", "b5"."RunTimeTicks", "b5"."SeasonId", "b5"."SeasonName", "b5"."SeriesId", "b5"."SeriesName", "b5"."SeriesPresentationUniqueKey", "b5"."ShowId", "b5"."Size", "b5"."SortName", "b5"."StartDate", "b5"."Studios", "b5"."Tagline", "b5"."Tags", "b5"."TopParentId", "b5"."TotalBitrate", "b5"."Type", "b5"."UnratedType", "b5"."Width", "b1"."Id", "b1"."ItemId", "b2"."ItemId", "b2"."ProviderId", "b2"."ProviderValue", "b3"."Id", "b3"."ItemId", "b4"."Id", "b4"."Blurhash", "b4"."DateModified", "b4"."Height", "b4"."ImageType", "b4"."ItemId", "b4"."Path", "b4"."Width"
FROM (
         SELECT "b0"."Id", "b0"."Album", "b0"."AlbumArtists", "b0"."Artists", "b0"."Audio", "b0"."ChannelId", "b0"."CleanName", "b0"."CommunityRating", "b0"."CriticRating", "b0"."CustomRating", "b0"."Data", "b0"."DateCreated", "b0"."DateLastMediaAdded", "b0"."DateLastRefreshed", "b0"."DateLastSaved", "b0"."DateModified", "b0"."EndDate", "b0"."EpisodeTitle", "b0"."ExternalId", "b0"."ExternalSeriesId", "b0"."ExternalServiceId", "b0"."ExtraIds", "b0"."ExtraType", "b0"."ForcedSortName", "b0"."Genres", "b0"."Height", "b0"."IndexNumber", "b0"."InheritedParentalRatingSubValue", "b0"."InheritedParentalRatingValue", "b0"."IsFolder", "b0"."IsInMixedFolder", "b0"."IsLocked", "b0"."IsMovie", "b0"."IsRepeat", "b0"."IsSeries", "b0"."IsVirtualItem", "b0"."LUFS", "b0"."MediaType", "b0"."Name", "b0"."NormalizationGain", "b0"."OfficialRating", "b0"."OriginalTitle", "b0"."Overview", "b0"."OwnerId", "b0"."ParentId", "b0"."ParentIndexNumber", "b0"."Path", "b0"."PreferredMetadataCountryCode", "b0"."PreferredMetadataLanguage", "b0"."PremiereDate", "b0"."PresentationUniqueKey", "b0"."PrimaryVersionId", "b0"."ProductionLocations", "b0"."ProductionYear", "b0"."RunTimeTicks", "b0"."SeasonId", "b0"."SeasonName", "b0"."SeriesId", "b0"."SeriesName", "b0"."SeriesPresentationUniqueKey", "b0"."ShowId", "b0"."Size", "b0"."SortName", "b0"."StartDate", "b0"."Studios", "b0"."Tagline", "b0"."Tags", "b0"."TopParentId", "b0"."TotalBitrate", "b0"."Type", "b0"."UnratedType", "b0"."Width"
         FROM (
                  SELECT DISTINCT "b"."Id", "b"."Album", "b"."AlbumArtists", "b"."Artists", "b"."Audio", "b"."ChannelId", "b"."CleanName", "b"."CommunityRating", "b"."CriticRating", "b"."CustomRating", "b"."Data", "b"."DateCreated", "b"."DateLastMediaAdded", "b"."DateLastRefreshed", "b"."DateLastSaved", "b"."DateModified", "b"."EndDate", "b"."EpisodeTitle", "b"."ExternalId", "b"."ExternalSeriesId", "b"."ExternalServiceId", "b"."ExtraIds", "b"."ExtraType", "b"."ForcedSortName", "b"."Genres", "b"."Height", "b"."IndexNumber", "b"."InheritedParentalRatingSubValue", "b"."InheritedParentalRatingValue", "b"."IsFolder", "b"."IsInMixedFolder", "b"."IsLocked", "b"."IsMovie", "b"."IsRepeat", "b"."IsSeries", "b"."IsVirtualItem", "b"."LUFS", "b"."MediaType", "b"."Name", "b"."NormalizationGain", "b"."OfficialRating", "b"."OriginalTitle", "b"."Overview", "b"."OwnerId", "b"."ParentId", "b"."ParentIndexNumber", "b"."Path", "b"."PreferredMetadataCountryCode", "b"."PreferredMetadataLanguage", "b"."PremiereDate", "b"."PresentationUniqueKey", "b"."PrimaryVersionId", "b"."ProductionLocations", "b"."ProductionYear", "b"."RunTimeTicks", "b"."SeasonId", "b"."SeasonName", "b"."SeriesId", "b"."SeriesName", "b"."SeriesPresentationUniqueKey", "b"."ShowId", "b"."Size", "b"."SortName", "b"."StartDate", "b"."Studios", "b"."Tagline", "b"."Tags", "b"."TopParentId", "b"."TotalBitrate", "b"."Type", "b"."UnratedType", "b"."Width"
                  FROM "BaseItems" AS "b"
                  WHERE "b"."Type" = 'MediaBrowser.Controller.Entities.Movies.Movie' AND "b"."IsVirtualItem" = @__isVirtualItem_Value_0 AND "b"."MediaType" = 'Video' AND EXISTS (
                      SELECT 1
                      FROM "AncestorIds" AS "a"
                      WHERE "b"."Id" = "a"."ParentItemId" AND "a"."ItemId" IN (
                          SELECT "f"."value"
                          FROM json_each(@__filter_AncestorIds_1) AS "f"
                      ))
              ) AS "b0"
         ORDER BY "b0"."SortName", "b0"."Name"
         LIMIT @__p_2
     ) AS "b5"
         LEFT JOIN "BaseItemTrailerTypes" AS "b1" ON "b5"."Id" = "b1"."ItemId"
         LEFT JOIN "BaseItemProviders" AS "b2" ON "b5"."Id" = "b2"."ItemId"
         LEFT JOIN "BaseItemMetadataFields" AS "b3" ON "b5"."Id" = "b3"."ItemId"
         LEFT JOIN "BaseItemImageInfos" AS "b4" ON "b5"."Id" = "b4"."ItemId"
ORDER BY "b5"."SortName", "b5"."Name", "b5"."Id", "b1"."Id", "b1"."ItemId", "b2"."ItemId", "b2"."ProviderId", "b3"."Id", "b3"."ItemId"

It seems the where-clause of the innermost query is mixed up. With the split of the AncestorIds parameter substituted this reads as:

SELECT 1
FROM "AncestorIds" AS "a"
WHERE "b"."Id" = "a"."ParentItemId" AND "a"."ItemId" IN ('BCB3F311-EECA-0ABB-DFF1-C3E99A43DFD8') -- The Id of my "movies" Folder BaseItem

Swapping the filter on ParentItemId and ItemId to the following returns the expected result set (multiple times, I assume because of the left joins).

SELECT 1
FROM "AncestorIds" AS "a"
WHERE "b"."Id" = "a"."ItemId" AND "a"."ParentItemId" IN ('BCB3F311-EECA-0ABB-DFF1-C3E99A43DFD8') -- Note the changed filter conditions
@allesmi commented on GitHub (May 12, 2025): I have investigated this bug a bit but I am not sure if I can provide a fix in reasonable time. Maybe someone else can save some time on debugging with this information. I do not have in-depth understanding of the code, please correct me if something is wrong. The collections should be created/added in the method `MediaBrowser.Controller.Library.ILibraryManager.GetItemList`. There is call to the Library Manager that returns 0 movies even though there should be some (tested with a fresh library consisting of four movies that should be part of the same collection). Digging deeper into the code here results in this query to Sqlite: ```sql SELECT "b5"."Id", "b5"."Album", "b5"."AlbumArtists", "b5"."Artists", "b5"."Audio", "b5"."ChannelId", "b5"."CleanName", "b5"."CommunityRating", "b5"."CriticRating", "b5"."CustomRating", "b5"."Data", "b5"."DateCreated", "b5"."DateLastMediaAdded", "b5"."DateLastRefreshed", "b5"."DateLastSaved", "b5"."DateModified", "b5"."EndDate", "b5"."EpisodeTitle", "b5"."ExternalId", "b5"."ExternalSeriesId", "b5"."ExternalServiceId", "b5"."ExtraIds", "b5"."ExtraType", "b5"."ForcedSortName", "b5"."Genres", "b5"."Height", "b5"."IndexNumber", "b5"."InheritedParentalRatingSubValue", "b5"."InheritedParentalRatingValue", "b5"."IsFolder", "b5"."IsInMixedFolder", "b5"."IsLocked", "b5"."IsMovie", "b5"."IsRepeat", "b5"."IsSeries", "b5"."IsVirtualItem", "b5"."LUFS", "b5"."MediaType", "b5"."Name", "b5"."NormalizationGain", "b5"."OfficialRating", "b5"."OriginalTitle", "b5"."Overview", "b5"."OwnerId", "b5"."ParentId", "b5"."ParentIndexNumber", "b5"."Path", "b5"."PreferredMetadataCountryCode", "b5"."PreferredMetadataLanguage", "b5"."PremiereDate", "b5"."PresentationUniqueKey", "b5"."PrimaryVersionId", "b5"."ProductionLocations", "b5"."ProductionYear", "b5"."RunTimeTicks", "b5"."SeasonId", "b5"."SeasonName", "b5"."SeriesId", "b5"."SeriesName", "b5"."SeriesPresentationUniqueKey", "b5"."ShowId", "b5"."Size", "b5"."SortName", "b5"."StartDate", "b5"."Studios", "b5"."Tagline", "b5"."Tags", "b5"."TopParentId", "b5"."TotalBitrate", "b5"."Type", "b5"."UnratedType", "b5"."Width", "b1"."Id", "b1"."ItemId", "b2"."ItemId", "b2"."ProviderId", "b2"."ProviderValue", "b3"."Id", "b3"."ItemId", "b4"."Id", "b4"."Blurhash", "b4"."DateModified", "b4"."Height", "b4"."ImageType", "b4"."ItemId", "b4"."Path", "b4"."Width" FROM ( SELECT "b0"."Id", "b0"."Album", "b0"."AlbumArtists", "b0"."Artists", "b0"."Audio", "b0"."ChannelId", "b0"."CleanName", "b0"."CommunityRating", "b0"."CriticRating", "b0"."CustomRating", "b0"."Data", "b0"."DateCreated", "b0"."DateLastMediaAdded", "b0"."DateLastRefreshed", "b0"."DateLastSaved", "b0"."DateModified", "b0"."EndDate", "b0"."EpisodeTitle", "b0"."ExternalId", "b0"."ExternalSeriesId", "b0"."ExternalServiceId", "b0"."ExtraIds", "b0"."ExtraType", "b0"."ForcedSortName", "b0"."Genres", "b0"."Height", "b0"."IndexNumber", "b0"."InheritedParentalRatingSubValue", "b0"."InheritedParentalRatingValue", "b0"."IsFolder", "b0"."IsInMixedFolder", "b0"."IsLocked", "b0"."IsMovie", "b0"."IsRepeat", "b0"."IsSeries", "b0"."IsVirtualItem", "b0"."LUFS", "b0"."MediaType", "b0"."Name", "b0"."NormalizationGain", "b0"."OfficialRating", "b0"."OriginalTitle", "b0"."Overview", "b0"."OwnerId", "b0"."ParentId", "b0"."ParentIndexNumber", "b0"."Path", "b0"."PreferredMetadataCountryCode", "b0"."PreferredMetadataLanguage", "b0"."PremiereDate", "b0"."PresentationUniqueKey", "b0"."PrimaryVersionId", "b0"."ProductionLocations", "b0"."ProductionYear", "b0"."RunTimeTicks", "b0"."SeasonId", "b0"."SeasonName", "b0"."SeriesId", "b0"."SeriesName", "b0"."SeriesPresentationUniqueKey", "b0"."ShowId", "b0"."Size", "b0"."SortName", "b0"."StartDate", "b0"."Studios", "b0"."Tagline", "b0"."Tags", "b0"."TopParentId", "b0"."TotalBitrate", "b0"."Type", "b0"."UnratedType", "b0"."Width" FROM ( SELECT DISTINCT "b"."Id", "b"."Album", "b"."AlbumArtists", "b"."Artists", "b"."Audio", "b"."ChannelId", "b"."CleanName", "b"."CommunityRating", "b"."CriticRating", "b"."CustomRating", "b"."Data", "b"."DateCreated", "b"."DateLastMediaAdded", "b"."DateLastRefreshed", "b"."DateLastSaved", "b"."DateModified", "b"."EndDate", "b"."EpisodeTitle", "b"."ExternalId", "b"."ExternalSeriesId", "b"."ExternalServiceId", "b"."ExtraIds", "b"."ExtraType", "b"."ForcedSortName", "b"."Genres", "b"."Height", "b"."IndexNumber", "b"."InheritedParentalRatingSubValue", "b"."InheritedParentalRatingValue", "b"."IsFolder", "b"."IsInMixedFolder", "b"."IsLocked", "b"."IsMovie", "b"."IsRepeat", "b"."IsSeries", "b"."IsVirtualItem", "b"."LUFS", "b"."MediaType", "b"."Name", "b"."NormalizationGain", "b"."OfficialRating", "b"."OriginalTitle", "b"."Overview", "b"."OwnerId", "b"."ParentId", "b"."ParentIndexNumber", "b"."Path", "b"."PreferredMetadataCountryCode", "b"."PreferredMetadataLanguage", "b"."PremiereDate", "b"."PresentationUniqueKey", "b"."PrimaryVersionId", "b"."ProductionLocations", "b"."ProductionYear", "b"."RunTimeTicks", "b"."SeasonId", "b"."SeasonName", "b"."SeriesId", "b"."SeriesName", "b"."SeriesPresentationUniqueKey", "b"."ShowId", "b"."Size", "b"."SortName", "b"."StartDate", "b"."Studios", "b"."Tagline", "b"."Tags", "b"."TopParentId", "b"."TotalBitrate", "b"."Type", "b"."UnratedType", "b"."Width" FROM "BaseItems" AS "b" WHERE "b"."Type" = 'MediaBrowser.Controller.Entities.Movies.Movie' AND "b"."IsVirtualItem" = @__isVirtualItem_Value_0 AND "b"."MediaType" = 'Video' AND EXISTS ( SELECT 1 FROM "AncestorIds" AS "a" WHERE "b"."Id" = "a"."ParentItemId" AND "a"."ItemId" IN ( SELECT "f"."value" FROM json_each(@__filter_AncestorIds_1) AS "f" )) ) AS "b0" ORDER BY "b0"."SortName", "b0"."Name" LIMIT @__p_2 ) AS "b5" LEFT JOIN "BaseItemTrailerTypes" AS "b1" ON "b5"."Id" = "b1"."ItemId" LEFT JOIN "BaseItemProviders" AS "b2" ON "b5"."Id" = "b2"."ItemId" LEFT JOIN "BaseItemMetadataFields" AS "b3" ON "b5"."Id" = "b3"."ItemId" LEFT JOIN "BaseItemImageInfos" AS "b4" ON "b5"."Id" = "b4"."ItemId" ORDER BY "b5"."SortName", "b5"."Name", "b5"."Id", "b1"."Id", "b1"."ItemId", "b2"."ItemId", "b2"."ProviderId", "b3"."Id", "b3"."ItemId" ``` It seems the where-clause of the innermost query is mixed up. With the split of the AncestorIds parameter substituted this reads as: ```sql SELECT 1 FROM "AncestorIds" AS "a" WHERE "b"."Id" = "a"."ParentItemId" AND "a"."ItemId" IN ('BCB3F311-EECA-0ABB-DFF1-C3E99A43DFD8') -- The Id of my "movies" Folder BaseItem ``` Swapping the filter on ParentItemId and ItemId to the following returns the expected result set (multiple times, I assume because of the left joins). ```sql SELECT 1 FROM "AncestorIds" AS "a" WHERE "b"."Id" = "a"."ItemId" AND "a"."ParentItemId" IN ('BCB3F311-EECA-0ABB-DFF1-C3E99A43DFD8') -- Note the changed filter conditions ```
Author
Owner

@allesmi commented on GitHub (May 15, 2025):

@theguymadmax Scenario 2 is probably still open - on first testing these two seemed unrelated.

@allesmi commented on GitHub (May 15, 2025): @theguymadmax Scenario 2 is probably still open - on first testing these two seemed unrelated.
Author
Owner

@theguymadmax commented on GitHub (May 15, 2025):

Thanks for the fix and yes, the second scenario seems to be a separate issue. I only put it in here to try and prevent unnecessary comments from people "Did you try using boxset plugin" "or I'm having the same issue on 10.10.7" -something along those lines.

I'll recheck the the behavior and create a separate issue depending on results.

@theguymadmax commented on GitHub (May 15, 2025): Thanks for the fix and yes, the second scenario seems to be a separate issue. I only put it in here to try and prevent unnecessary comments from people "Did you try using boxset plugin" "or I'm having the same issue on 10.10.7" -something along those lines. I'll recheck the the behavior and create a separate issue depending on results.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#7002