System.InvalidOperationException: Sequence contains more than one element

Sonarr version (exact version): 2.0.0.5344
OS: Arch + Docker
Debug logs:

[v2.0.0.5344] System.InvalidOperationException: Sequence contains more than one element
  at System.Linq.Enumerable.SingleOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0007b] in <798dd06330af4ca3886d7d2be5573af7>:0 
  at NzbDrone.Core.Tv.SeriesRepository.FindByTitle (System.String cleanTitle) [0x0001e] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Tv\SeriesRepository.cs:33 
  at NzbDrone.Core.Tv.SeriesService.FindByTitle (System.String title) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Tv\SeriesService.cs:82 
  at NzbDrone.Core.Parser.ParsingService.GetSeries (System.String title) [0x0004b] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Parser\ParsingService.cs:56 
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService.ProcessFolder (System.String rootFolder, System.String baseFolder, System.String downloadId) [0x00035] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:104 
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService+<>c__DisplayClass15_0.<ProcessFolder>b__1 (System.String subfolder) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:123 
  at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x00051] in <798dd06330af4ca3886d7d2be5573af7>:0 
  at System.Linq.Enumerable+ConcatIterator`1[TSource].MoveNext () [0x0002b] in <798dd06330af4ca3886d7d2be5573af7>:0 
  at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x00030] in <798dd06330af4ca3886d7d2be5573af7>:0 
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <798dd06330af4ca3886d7d2be5573af7>:0 
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService.ProcessFolder (System.String rootFolder, System.String baseFolder, System.String downloadId) [0x000f9] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:125 
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService.GetMediaFiles (System.String path, System.String downloadId) [0x00072] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:97 
  at NzbDrone.Api.ManualImport.ManualImportModule.GetMediaFiles () [0x001c4] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Api\ManualImport\ManualImportModule.cs:28 
  at NzbDrone.Api.REST.RestModule`1[TResource].<set_GetResourceAll>b__32_0 (System.Object options) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Api\REST\RestModule.cs:111 
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Func`2<object, object>,object)
  at Nancy.Routing.Route+<>c__DisplayClass4.<Wrap>b__3 (System.Object parameters, System.Threading.CancellationToken context) [0x00049] in <63c44d6f8d7e4f339a987bf9eb94d931>:0

Description of issue:
I’m trying to import some episodes and am running into this issue. I think the issue is specifically with the two shows, The Haunting and The Haunting Of.

Definitely possible, could you post the full debug somewhere and link it here?

The full debug isn’t actually very long:

[Trace] Http: Req: 69210 [GET] /api/manualimport?folder=%2Fpath%2Fto%2Fseries%2F&sort_by=qualityWeight&order=desc
[Debug] Parser: Parsing string 'Series'
[Debug] Parser: Unable to parse Series
[Debug] DiskScanService: Scanning '/path/to/series/' for video files
[Trace] DiskScanService: 0 files were found in /path/to/series/
[Debug] DiskScanService: 0 video files were found in /path/to/series/
[Debug] Parser: Parsing string 'The.Haunting.Of.S01E01.Beverley.Mitchell.720p.HDTV.x264-DHD'
[Trace] Parser: ^(?<title>.+?)(?:(?:[-_\W](?<![()\[!]))+S?(?<season>(?<!\d+)(?:\d{1,2})(?!\d+))(?:[ex]|\W[ex]){1,2}(?<episode>\d{2,3}(?!\d+))(?:(?:\-|[ex]|\W[ex]|_){1,2}(?<episode>\d{2,3}(?!\d+)))*)\W?(?!\\)
[Debug] Parser: Episode Parsed. The Haunting Of - S01E01
[Debug] Parser: Language parsed: English
[Debug] QualityParser: Trying to parse quality for The.Haunting.Of.S01E01.Beverley.Mitchell.720p.HDTV.x264-DHD
[Debug] Parser: Quality parsed: HDTV-720p v1
[Debug] Parser: Release Group parsed: DHD
[Trace] NzbDroneErrorPipeline: Handling Exception
[Fatal] NzbDroneErrorPipeline: Request Failed. GET /api/manualimport

[v2.0.0.5344] System.InvalidOperationException: Sequence contains more than one element
  at System.Linq.Enumerable.SingleOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0007b] in <798dd06330af4ca3886d7d2be5573af7>:0
  at NzbDrone.Core.Tv.SeriesRepository.FindByTitle (System.String cleanTitle) [0x0001e] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Tv\SeriesRepository.cs:33
  at NzbDrone.Core.Tv.SeriesService.FindByTitle (System.String title) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Tv\SeriesService.cs:82
  at NzbDrone.Core.Parser.ParsingService.GetSeries (System.String title) [0x0004b] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\Parser\ParsingService.cs:56
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService.ProcessFolder (System.String rootFolder, System.String baseFolder, System.String downloadId) [0x00035] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:104
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService+<>c__DisplayClass15_0.<ProcessFolder>b__1 (System.String subfolder) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:123
  at System.Linq.Enumerable+SelectManySingleSelectorIterator`2[TSource,TResult].MoveNext () [0x00051] in <798dd06330af4ca3886d7d2be5573af7>:0
  at System.Linq.Enumerable+ConcatIterator`1[TSource].MoveNext () [0x0002b] in <798dd06330af4ca3886d7d2be5573af7>:0
  at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].ToList () [0x00030] in <798dd06330af4ca3886d7d2be5573af7>:0
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <798dd06330af4ca3886d7d2be5573af7>:0
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService.ProcessFolder (System.String rootFolder, System.String baseFolder, System.String downloadId) [0x000f9] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:125
  at NzbDrone.Core.MediaFiles.EpisodeImport.Manual.ManualImportService.GetMediaFiles (System.String path, System.String downloadId) [0x00072] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Core\MediaFiles\EpisodeImport\Manual\ManualImportService.cs:97
  at NzbDrone.Api.ManualImport.ManualImportModule.GetMediaFiles () [0x001c4] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Api\ManualImport\ManualImportModule.cs:28
  at NzbDrone.Api.REST.RestModule`1[TResource].<set_GetResourceAll>b__32_0 (System.Object options) [0x00000] in C:\BuildAgent\work\5d7581516c0ee5b3\src\NzbDrone.Api\REST\RestModule.cs:111
  at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Func`2<object, object>,object)
  at Nancy.Routing.Route+<>c__DisplayClass4.<Wrap>b__3 (System.Object parameters, System.Threading.CancellationToken context) [0x00049] in <63c44d6f8d7e4f339a987bf9eb94d931>:0

Thanks for the info, this will be fixed in an upcoming v3 release.

Excellent, thanks!

Hi everyone,

sorry for reviving this thread but I am also encountering the same issues with Linq

[Error] EventAggregator: ExtraService failed while processing [SeriesScannedEvent]
[v3.0.6.1196] System.InvalidOperationException: Sequence contains more than one element
  at System.Linq.Enumerable.SingleOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0007b] in <798dd06330af4ca3886d7d2be5573af7>:0 
  at NzbDrone.Core.Extras.Files.ExtraFileRepository`1[TExtraFile].FindByPath (System.String path) [0x0000d] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Extras\Files\ExtraFileRepository.cs:59 
  at NzbDrone.Core.Extras.Files.ExtraFileService`1[TExtraFile].FindByPath (System.String path) [0x00000] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Extras\Files\ExtraFileService.cs:64 
  at NzbDrone.Core.Extras.Others.OtherExtraFileRenamer.RemoveOtherExtraFile (NzbDrone.Core.Tv.Series series, System.String path) [0x0001c] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Extras\Others\OtherExtraFileRenamer.cs:74 
  at NzbDrone.Core.Extras.Others.OtherExtraFileRenamer.RenameOtherExtraFile (NzbDrone.Core.Tv.Series series, System.String path) [0x00038] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Extras\Others\OtherExtraFileRenamer.cs:55 
  at NzbDrone.Core.Extras.Metadata.MetadataService.ProcessEpisodeMetadata (NzbDrone.Core.Extras.Metadata.IMetadata consumer, NzbDrone.Core.Tv.Series series, NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, System.Collections.Generic.List`1[T] existingMetadataFiles) [0x00032] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Extras\Metadata\MetadataService.cs:269 
  at NzbDrone.Core.Extras.Metadata.MetadataService.CreateAfterSeriesScan (NzbDrone.Core.Tv.Series series, System.Collections.Generic.List`1[T] episodeFiles) [0x000b8] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Extras\Metadata\MetadataService.cs:107 
  at NzbDrone.Core.Extras.ExtraService.Handle (NzbDrone.Core.MediaFiles.Events.SeriesScannedEvent message) [0x0002a] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Extras\ExtraService.cs:153 
  at NzbDrone.Core.Messaging.Events.EventAggregator.PublishEvent[TEvent] (TEvent event) [0x0011a] in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Core\Messaging\Events\EventAggregator.cs:92

It is manifesting itself when trying to generate the metadata for Young Sheldon
As you can see from the logs I’m on version 3.0.6.1196 on a docker image running on raspbian.

Could someone help me with this?

Thanks

don’t hijack threads please

butpretty sure this is fixed in nightly alreadu

1 Like

Sorry for hijacking, and thank you for suggesting the nightly. I’ll be trying that out.