LizardByte / Themerr-jellyfin

Plugin for Jellyfin that adds theme songs to movies and tv shows using ThemerrDB.
https://app.lizardbyte.dev/ThemerrDB
GNU Affero General Public License v3.0
131 stars 8 forks source link

Newtonsoft.Json.JsonReaderException: Additional text encountered after finished reading JSON content #321

Closed John5798 closed 5 months ago

John5798 commented 6 months ago

Describe the Bug

When the plugin settings window is opened. it throws an error "Unexpected error occurred creating progress dashboard" and nothing else except the setting to change the update interval is shown.

Screenshot 2024-05-14 103121
[10:30:49] [INF] [15] Jellyfin.Plugin.Themerr.Api.ThemerrController: Server culture: en-US
[10:30:54] [ERR] [61] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL GET /Themerr/GetProgress.
Newtonsoft.Json.JsonReaderException: Additional text encountered after finished reading JSON content: }. Path '', line 1, position 167.
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Jellyfin.Plugin.Themerr.ThemerrManager.GetExistingThemerrDataValue(String key, String themerrDataPath)
   at Jellyfin.Plugin.Themerr.ThemerrManager.GetThemeProvider(BaseItem item)
   at Jellyfin.Plugin.Themerr.Api.ThemerrController.GetProgress()
   at lambda_method2175(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, 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.<InvokeNextResourceFilter>g__Awaited|25_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.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
   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.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
   at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

Also, the update theme songs task fails midway.

https://pastebin.com/SLZE4qmG

I tried refreshing all metadata for my libraries and also tried completely removing the plugin and residues and reinstalling. None seemed to work or change the behavior of the plugin.

Expected Behavior

A progress and list of movie and show names should have been shown inplace of an error and the scheduled task should have passed without an error.

Additional Context

OS: Ubuntu Linux 24.04 Noble Numbat Jellyfin Installation: Official Docker 10.9.1 Kernel: 6.8.0-31-generic Plugin Version: 2024.514.151.24 Plugin Installation type: Repository

haloTT100 commented 6 months ago

Same thing is happening to me. The weird part is when I first installed the plugin and started the scan, it actually showed me the progress dashboard, but after some time it just broke.

ReenigneArcher commented 6 months ago

I have created #331 to try to improve the error handling, it won't solve the problem, but it may help me identify the cause. Can you run this build and provide new logs?

You can download from here, if logged in to GitHub: https://github.com/LizardByte/Themerr-jellyfin/actions/runs/9134783177/artifacts/1514802319

haloTT100 commented 6 months ago

Same Unexpected error occurred creating progress dashboard, and I'm not getting any error messages only the usual "[WRN] [21] Jellyfin.Plugin.Themerr.ThemerrManager: Missing from ThemerrDB: "Movie", contribute:"

ReenigneArcher commented 6 months ago

@haloTT100 in that case, the cause of your error is not the same. This issue is due to an invalid json read. Please open a separate issue with relevant logs from both jellyfin logs as well as browser logs.

John5798 commented 6 months ago

I have created #331 to try to improve the error handling, it won't solve the problem, but it may help me identify the cause. Can you run this build and provide new logs?

You can download from here, if logged in to GitHub: https://github.com/LizardByte/Themerr-jellyfin/actions/runs/9134783177/artifacts/1514802319

My server is down at the moment (CPU fans blown). I could test it by Thursday the coming week. Sorry for the inconvenience and thanks for your awesome project!

John5798 commented 5 months ago

@ReenigneArcher Hi, I'm back again after a long break. What could I do to help solve the error?

ReenigneArcher commented 5 months ago

@John5798 testing the artifacts from the url I posted previously would help, and providing new logs.

John5798 commented 5 months ago

@John5798 testing the artifacts from the url I posted previously would help, and providing new logs.

I'm using the exact configuration specified in the 1st comment but with the provided artifact file installed (v 0.0.0.0)

Screenshot 2024-06-08 002444 When opening the plugin settings page, the above is displayed. The corresponding debug log is as follows, https://pastebin.com/Aa5x4cPp

The following link corresponds to the logs and final error when running the plugin from the scheduled tasks tab, https://pastebin.com/v6LKNuVb Hope this helps.

ReenigneArcher commented 5 months ago

@John5798 thank you!

Please open this file: /movies/Damsel (2024) [imdbid-tt13452446]/themerr.json

And change the content from:

{"downloaded_timestamp":"2024-05-14T00:57:45.808227Z","theme_md5":"a92cfeb9055207dd0f1b46a1c35b5ff0","youtube_theme_url":"https://www.youtube.com/watch?v=NTdE0XgueC0"}}

to:

{"downloaded_timestamp":"2024-05-14T00:57:45.808227Z","theme_md5":"a92cfeb9055207dd0f1b46a1c35b5ff0","youtube_theme_url":"https://www.youtube.com/watch?v=NTdE0XgueC0"}

Notice the extra } at the end of the file.

If it works after that, it means only that single file was corrupted. If it fails, you probably have multiple corrupted files. If it fails again please post new logs just in case.

John5798 commented 5 months ago

@ReenigneArcher Thank you very much! The above solution worked! Now both the task and the settings page work without erroring out! Thanks for your patience and for this awesome project. Also, could I now upgrade to the latest version from the repo? Thanks again and have a great day!

ReenigneArcher commented 5 months ago

Cool, glad it's working!

It should be fine to switch back to the repo.