[PR #4221] [MERGED] Fix InvalidOperationException in TvdbSeriesProvider.MapSeriesToResult #9954

Closed
opened 2026-02-07 06:11:26 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/4221
Author: @Spacetech
Created: 9/28/2020
Status: Merged
Merged: 10/10/2020
Merged by: @dkanada

Base: masterHead: tvdb_series_provider_InvalidOperationException


📝 Commits (3)

  • 303ecca Fix InvalidOperationException in TvdbSeriesProvider
  • 881a7fa update based on suggestions
  • fd7a369 simplify EndDate query

📊 Changes

1 file changed (+16 additions, -14 deletions)

View changed files

📝 MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs (+16 -14)

📄 Description

Fixes the following error:

[2020-09-27 15:27:01.483 -07:00] [ERR] [77] MediaBrowser.Providers.TV.SeriesMetadataService: Error in "TheTVDB"
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.Max(IEnumerable`1 source)
   at MediaBrowser.Providers.Plugins.TheTvdb.TvdbSeriesProvider.MapSeriesToResult(MetadataResult`1 result, Series tvdbSeries, String metadataLanguage) in C:\Programming\jellyfin\MediaBrowser.Providers\Plugins\TheTvdb\TvdbSeriesProvider.cs:line 345
   at MediaBrowser.Providers.Plugins.TheTvdb.TvdbSeriesProvider.FetchSeriesData(MetadataResult`1 result, String metadataLanguage, Dictionary`2 seriesProviderIds, CancellationToken cancellationToken) in C:\Programming\jellyfin\MediaBrowser.Providers\Plugins\TheTvdb\TvdbSeriesProvider.cs:line 126
   at MediaBrowser.Providers.Plugins.TheTvdb.TvdbSeriesProvider.GetMetadata(SeriesInfo itemId, CancellationToken cancellationToken) in C:\Programming\jellyfin\MediaBrowser.Providers\Plugins\TheTvdb\TvdbSeriesProvider.cs:line 90
   at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken) in C:\Programming\jellyfin\MediaBrowser.Providers\Manager\MetadataService.cs:line 853

This happens when determining the end date for a series. Specifically, if episodesPage or AiredSeasons contain no elements (likely due to incomplete / bad data in TVDB).

Changes

  • Confirm there are values in the arrays before Max()ing them.
  • Change MapSeriesToResult to be async. Since the caller is async and this method was using .Result for tasks, it should be an async method.

Issues
None that I saw


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/4221 **Author:** [@Spacetech](https://github.com/Spacetech) **Created:** 9/28/2020 **Status:** ✅ Merged **Merged:** 10/10/2020 **Merged by:** [@dkanada](https://github.com/dkanada) **Base:** `master` ← **Head:** `tvdb_series_provider_InvalidOperationException` --- ### 📝 Commits (3) - [`303ecca`](https://github.com/jellyfin/jellyfin/commit/303eccaffeb42eb39b04f3ed372dc9fe84de5455) Fix InvalidOperationException in TvdbSeriesProvider - [`881a7fa`](https://github.com/jellyfin/jellyfin/commit/881a7fa90805ac96d1e43c426c50dbe575297a9b) update based on suggestions - [`fd7a369`](https://github.com/jellyfin/jellyfin/commit/fd7a36932da16fb1e85160aaa0da792303a4e72f) simplify EndDate query ### 📊 Changes **1 file changed** (+16 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs` (+16 -14) </details> ### 📄 Description Fixes the following error: ``` [2020-09-27 15:27:01.483 -07:00] [ERR] [77] MediaBrowser.Providers.TV.SeriesMetadataService: Error in "TheTVDB" System.InvalidOperationException: Sequence contains no elements at System.Linq.ThrowHelper.ThrowNoElementsException() at System.Linq.Enumerable.Max(IEnumerable`1 source) at MediaBrowser.Providers.Plugins.TheTvdb.TvdbSeriesProvider.MapSeriesToResult(MetadataResult`1 result, Series tvdbSeries, String metadataLanguage) in C:\Programming\jellyfin\MediaBrowser.Providers\Plugins\TheTvdb\TvdbSeriesProvider.cs:line 345 at MediaBrowser.Providers.Plugins.TheTvdb.TvdbSeriesProvider.FetchSeriesData(MetadataResult`1 result, String metadataLanguage, Dictionary`2 seriesProviderIds, CancellationToken cancellationToken) in C:\Programming\jellyfin\MediaBrowser.Providers\Plugins\TheTvdb\TvdbSeriesProvider.cs:line 126 at MediaBrowser.Providers.Plugins.TheTvdb.TvdbSeriesProvider.GetMetadata(SeriesInfo itemId, CancellationToken cancellationToken) in C:\Programming\jellyfin\MediaBrowser.Providers\Plugins\TheTvdb\TvdbSeriesProvider.cs:line 90 at MediaBrowser.Providers.Manager.MetadataService`2.ExecuteRemoteProviders(MetadataResult`1 temp, String logName, TIdType id, IEnumerable`1 providers, CancellationToken cancellationToken) in C:\Programming\jellyfin\MediaBrowser.Providers\Manager\MetadataService.cs:line 853 ``` This happens when determining the end date for a series. Specifically, if `episodesPage` or `AiredSeasons` contain no elements (likely due to incomplete / bad data in TVDB). **Changes** - Confirm there are values in the arrays before `Max()`ing them. - Change `MapSeriesToResult` to be async. Since the caller is async and this method was using `.Result` for tasks, it should be an async method. **Issues** None that I saw --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 06:11:26 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#9954