SteamGridDBMetadata
SteamGridDBMetadata copied to clipboard
Error parsing HTML as JSON
It looks like there is some case where the site can give back a 404 with html response, and the extension still tries to parse it as JSON. This causes Playnite to crash with an unrecoverable error. Log below.
22-05 12:58:57.209|INFO|SGDBMetadata:SGDB Initialized
22-05 12:58:57.209|INFO|SGDBMetadataProvider:AvailableFields
22-05 12:58:57.209|INFO|SGDBMetadataProvider:GetAvailableFields
22-05 12:58:57.209|INFO|SgdbServiceClient:getHeroImageUrl
22-05 12:58:57.209|INFO|SgdbServiceClient:
22-05 12:58:57.209|INFO|SgdbServiceClient:
22-05 12:58:57.209|INFO|SgdbServiceClient:
22-05 12:58:57.209|INFO|SgdbServiceClient:
22-05 12:58:57.209|INFO|SgdbServiceClient:
22-05 12:58:57.209|INFO|SgdbServiceClient:https://www.steamgriddb.com/api/v2/search/autocomplete/
22-05 12:58:57.469|INFO|SgdbServiceClient:<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="dns-prefetch" href="https://cdn2.steamgriddb.com/">
<link rel="preconnect" href="https://cdn2.steamgriddb.com/">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/static/assets/style.css?1620953414">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no, user-scalable=no">
<title>404 - Not Found - SteamGridDB</title>
<link rel="icon" type="image/png" href="/static/favicon/16.png" sizes="16x16">
<meta name="theme-color" content="#5fb4f0">
<meta property="og:url" content="https://www.steamgriddb.com">
<meta property="og:site_name" content="SteamGridDB">
<link rel="apple-touch-icon" href="/static/img/logo-512.png"/>
<link rel="preload" as="fetch" href="/api/public/user" crossorigin="anonymous">
<meta property="og:title" content="404 - Not Found">
<meta property="og:type" content="website">
<meta name="description" content="Download and share custom video game assets and personalize your gaming library.">
<meta property="og:description" content="Download and share custom video game assets and personalize your gaming library.">
<meta property="og:image" content="https://www.steamgriddb.com/static/img/logo-512.png">
<link rel="image_src" href="https://www.steamgriddb.com/static/img/logo-512.png">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-77667516-1"></script>
</head>
<body>
<div id="render-me-uwu" style="display:flex;flex-wrap:wrap;flex:1;width:100%;"></div>
<script src="/static/assets/3e96c4cb1561914eaf1b.js"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-77667516-1');
</script>
<script defer src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon='{"rayId":"6537979b6fa7c90f","version":"2021.5.1","r":1,"token":"cc387f82b65b45c49d4817f6277638f9","si":10}'></script>
</body>
</html>
22-05 12:58:57.622|DEBUG|BaseCollectionView:Refreshing collection view filter.
22-05 12:58:57.742|ERROR|PlayniteApplication:Unhandled exception occured.System.AggregateException: One or more errors occurred. ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
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 Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at SGDBMetadata.SgdbServiceClient.Execute[T](RestRequest request) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 47
at SGDBMetadata.SgdbServiceClient.getSGDBGames(String searchName) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 56
at SGDBMetadata.SgdbServiceClient.getGameSGDBFuzzySearch(String gameTitle) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 125
at SGDBMetadata.SgdbServiceClient.getHeroImageUrl(String gameName, String platform, String gameId) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 241
at SGDBMetadata.SGDBMetadataProvider.GetBackgroundImage() in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBMetadataProvider.cs:line 135
at Playnite.Metadata.MetadataDownloader.ProcessField(Game game, MetadataFieldSettings fieldSettings, MetadataField gameField, Func`2 propertySelector, Dictionary`2 existingStoreData, Dictionary`2 existingPluginData) in G:\misc-source\Playnite\source\Playnite\Metadata\MetadataDownloader.cs:line 218
at Playnite.Metadata.MetadataDownloader.<>c__DisplayClass10_0.<DownloadMetadataAsync>b__0() in G:\misc-source\Playnite\source\Playnite\Metadata\MetadataDownloader.cs:line 494
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Playnite.DesktopApp.ViewModels.DesktopAppViewModel.<>c__DisplayClass378_0.<UpdateLibrary>b__0() in G:\misc-source\Playnite\source\Playnite.DesktopApp\ViewModels\DesktopAppViewModel.cs:line 1230
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Playnite.DesktopApp.ViewModels.DesktopAppViewModel.<UpdateLibrary>d__378.MoveNext() in G:\misc-source\Playnite\source\Playnite.DesktopApp\ViewModels\DesktopAppViewModel.cs:line 1241
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Playnite.PlayniteApplication.Run() in G:\misc-source\Playnite\source\Playnite\App\PlayniteApplication.cs:line 437
at Playnite.DesktopApp.ProgramEntry.Main(String[] args) in G:\misc-source\Playnite\source\Playnite.DesktopApp\ProgramEntry.cs:line 51
---> (Inner Exception #0) Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
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 Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at SGDBMetadata.SgdbServiceClient.Execute[T](RestRequest request) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 47
at SGDBMetadata.SgdbServiceClient.getSGDBGames(String searchName) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 56
at SGDBMetadata.SgdbServiceClient.getGameSGDBFuzzySearch(String gameTitle) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 125
at SGDBMetadata.SgdbServiceClient.getHeroImageUrl(String gameName, String platform, String gameId) in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBService.cs:line 241
at SGDBMetadata.SGDBMetadataProvider.GetBackgroundImage() in U:\App_Dev\SGDBMetadata\SGDBMetadata\SGDBMetadata\SGDBMetadataProvider.cs:line 135
at Playnite.Metadata.MetadataDownloader.ProcessField(Game game, MetadataFieldSettings fieldSettings, MetadataField gameField, Func`2 propertySelector, Dictionary`2 existingStoreData, Dictionary`2 existingPluginData) in G:\misc-source\Playnite\source\Playnite\Metadata\MetadataDownloader.cs:line 218
at Playnite.Metadata.MetadataDownloader.<>c__DisplayClass10_0.<DownloadMetadataAsync>b__0() in G:\misc-source\Playnite\source\Playnite\Metadata\MetadataDownloader.cs:line 494
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<---
I was able to narrow this down to a few games having an empty Name field. Obviously that wasn't ideal, and all is fine after fixing them.
It would still be great if those entries could be ignored rather than causing the app to crash.