V4 Upgrade error, Sequence contains more than one matching element

Sonarr version (exact version): 4.0.0.539
Mono version (if Sonarr is not running on Windows): no idea (bash: mono: command not found)
OS: Unraid
Debug logs:

2023-06-21 15:36:18.8|Info|Sonarr.Http.Authentication.ApiKeyAuthenticationHandler|AuthenticationScheme: SignalR was challenged.
2023-06-21 15:36:21.6|Debug|Api|[GET] /api/v3/localization/language: 200.OK (9 ms)
2023-06-21 15:36:21.6|Debug|Api|[GET] /api/v3/tag: 200.OK (9 ms)
2023-06-21 15:36:21.6|Debug|Api|[GET] /api/v3/language: 200.OK (11 ms)
2023-06-21 15:36:21.6|Debug|Api|[GET] /api/v3/customFilter: 200.OK (16 ms)
2023-06-21 15:36:21.6|Debug|Api|[GET] /api/v3/localization: 200.OK (41 ms)
2023-06-21 15:36:21.6|Debug|Api|[GET] /api/v3/qualityprofile: 200.OK (33 ms)
2023-06-21 15:36:21.6|Debug|Api|[GET] /api/v3/config/ui: 200.OK (18 ms)
2023-06-21 15:36:21.7|Debug|Api|[GET] /api/v3/importlist: 200.OK (40 ms)
2023-06-21 15:36:21.7|Debug|Api|[GET] /api/v3/system/status: 200.OK (60 ms)
2023-06-21 15:36:23.7|Fatal|SonarrErrorPipeline|Request Failed. GET /api/v3/series

[v4.0.0.539] System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
   at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at Sonarr.Api.V3.Series.SeriesController.LinkSeriesStatistics(SeriesResource resource, SeriesStatistics seriesStatistics) in ./Sonarr.Api.V3/Series/SeriesController.cs:line 226
   at Sonarr.Api.V3.Series.SeriesController.LinkSeriesStatistics(List`1 resources, List`1 seriesStatistics) in ./Sonarr.Api.V3/Series/SeriesController.cs:line 212
   at Sonarr.Api.V3.Series.SeriesController.AllSeries(Nullable`1 tvdbId, Boolean includeSeasonImages) in ./Sonarr.Api.V3/Series/SeriesController.cs:line 114
   at lambda_method113(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Sonarr.Http.Middleware.BufferingMiddleware.InvokeAsync(HttpContext context) in ./Sonarr.Http/Middleware/BufferingMiddleware.cs:line 27
   at Sonarr.Http.Middleware.IfModifiedMiddleware.InvokeAsync(HttpContext context) in ./Sonarr.Http/Middleware/IfModifiedMiddleware.cs:line 40
   at Sonarr.Http.Middleware.CacheHeaderMiddleware.InvokeAsync(HttpContext context) in ./Sonarr.Http/Middleware/CacheHeaderMiddleware.cs:line 32
   at Sonarr.Http.Middleware.StartingUpMiddleware.InvokeAsync(HttpContext context) in ./Sonarr.Http/Middleware/StartingUpMiddleware.cs:line 37
   at Sonarr.Http.Middleware.UrlBaseMiddleware.InvokeAsync(HttpContext context) in ./Sonarr.Http/Middleware/UrlBaseMiddleware.cs:line 26
   at Sonarr.Http.Middleware.VersionMiddleware.InvokeAsync(HttpContext context) in ./Sonarr.Http/Middleware/VersionMiddleware.cs:line 28
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)

Description of issue:
On docker using Unraid, after upgrading from v3 to v4 I can watch the logs doing the upgrades and running scan checks, but after logging into the UI it just throws an error and I can’t get into the UI whatseover. The logs above are shown immediately after a successful login, with the UI throwing the error below.

Sequence contains more than one matching element
Version 4.0.0.539

something in my config/backup is causing this and i have no idea what this error is in reference to. i can load up the v4 installation fresh and work it just fine. i’ve tried taking a backup from v3 and loading restoring from the backup file in the fresh installation of v4, but there’s something there it doesn’t like. i’ve also tried copying the original v3 config folder and just pointing the v4 installation to this copied directory. both methods show logs to be upgrading the internals as needed and come to the same error after login.

This appears to be due to a series that has multiple seasons with the same season number (which should never happen).

Possibly the same as this issue: Cant add series Bargain Hunt UK, though it could be another series entirely.

I’ll have to look at what we can do to clean this up for existing series.

I don’t have that particular series and don’t think it was due to a series with duplicate TVDB seasons. I went through all my series’ links to TVDB and checked.

I removed a bunch of series that were unmonitored and didn’t have any local data, also fixed one particular series (Dragon Ball Super) that wasn’t finding local files I DID have. Dragon Ball Super got stuck where there was a file with an encoded character in the filename (slash with a couple numbers), and also this series had local folders of both the Season [00] and Season [0] formats of the same seasons with episodes in both, maybe that was the issue? Once I cleared those up and upgraded, I could get in, and added back the unmonitored shows I previously removed without issue.

In any case, now successfully on v4.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.