jellyfin-archive / jellyfin-plugin-autoorganize

https://jellyfin.org
MIT License
41 stars 27 forks source link

Internal Server Error when saving setting #68

Closed grafixeyehero closed 2 years ago

grafixeyehero commented 3 years ago
[23:26:38] [ERR] [16] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL POST /System/Configuration/autoorganize.
System.Text.Json.JsonException: The JSON value could not be converted to System.Boolean. Path: $.MovieOptions.CopyOriginalFile | LineNumber: 0 | BytePositionInLine: 764.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a boolean.
   at System.Text.Json.Utf8JsonReader.GetBoolean()
   at MediaBrowser.Common.Json.Converters.JsonBoolNumberConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\MediaBrowser.Common\Json\Converters\JsonBoolNumberConverter.cs:line 21
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCoreAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
   at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
   at Jellyfin.Api.Controllers.ConfigurationController.UpdateNamedConfiguration(String key) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Api\Controllers\ConfigurationController.cs:line 96
   at lambda_method796(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   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.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   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 Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Server\Middleware\ServerStartupMessageMiddleware.cs:line 41
   at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Server\Middleware\WebSocketHandlerMiddleware.cs:line 33
   at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Server\Middleware\IpBasedAccessValidationMiddleware.cs:line 38
   at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Server\Middleware\LanFilteringMiddleware.cs:line 45
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Server\Middleware\LegacyEmbyRouteRewriteMiddleware.cs:line 51
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Server\Middleware\ResponseTimeMiddleware.cs:line 63
   at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context) in C:\Users\Admin\Documents\grafixeye repo\Jellyfin\Jellyfin.Server\Middleware\ExceptionMiddleware.cs:line 55
[23:26:39] [WRN] [16] Jellyfin.Server.Middleware.ResponseTimeMiddleware: Slow HTTP Response from http://127.0.0.1:8096/System/Configuration/autoorganize to 127.0.0.1 in 0:00:01.2950979 with Status Code 500

System (please complete the following information):

Sythelux commented 2 years ago

This is still present on 10.8.*

I figured out a solution. We could make MovieFileOrganizationOptions.CopyOriginalFile an enum and change the HTML accordingly.

I can make a pull request about that, but I'm not sure if one of the main devs is already working on that anyway.

(this would also help with ideas such as: #24 to not have only a boolean)

Marctraider commented 2 years ago

Same issue here.

Typhooni commented 2 years ago

This issue is in Jellyfin 10.8 Alpha 3 with AutoOrganize 10.0.

grafixeyehero commented 2 years ago

Fixed by #74