tpill90 / epic-lancache-prefill

CLI tool to automatically prime a Lancache with Epic Launcher games
https://tpill90.github.io/epic-lancache-prefill/
MIT License
45 stars 4 forks source link

"Cannot get the value of a token type 'Number' as a string" #24

Closed tkrusterholz closed 4 months ago

tkrusterholz commented 1 year ago

Encountered this error upon first run of the select-apps command. Looks like the root error is "Cannot get the value of a token type 'Number' as a string"

System.Text.Json.JsonException: The JSON value could not be converted to System.Collections.Generic.List`1[ System.String]. Path: $[0] | LineNumber: 0 | BytePositionInLine: 8. System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string. at string System.Text.Json.Utf8JsonReader.GetString() at bool System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(ref Utf8JsonReader , Type , JsonSerializerOptions , ref ReadStack , out TCollection ) at bool System.Text.Json.Serialization.JsonConverter`1.TryRead(ref Utf8JsonReader , Type , JsonSerializerOptions , ref ReadStack , out T ) at T System.Text.Json.Serialization.JsonConverter`1.ReadCore(ref Utf8JsonReader , JsonSerializerOptions , ref ReadStack ) at void System.Text.Json.ThrowHelper.ReThrowWithPath(ref ReadStack , in Utf8JsonReader , Exception ) at T System.Text.Json.Serialization.JsonConverter`1.ReadCore(ref Utf8JsonReader , JsonSerializerOptions , ref ReadStack ) at TValue System.Text.Json.JsonSerializer.ReadFromSpan(ReadOnlySpan , JsonTypeInfo , int? ) at TValue System.Text.Json.JsonSerializer.ReadFromSpan(ReadOnlySpan , JsonTypeInfo ) at TValue System.Text.Json.JsonSerializer.Deserialize(string , JsonTypeInfo ) at List EpicPrefill.EpicGamesManager.LoadPreviouslySelectedApps() at async Task<List> EpicPrefill.CliCommands.SelectAppsCommand.BuildTuiAppModelsAsync(EpicGamesManager epicManager) at async ValueTask EpicPrefill.CliCommands.SelectAppsCommand.ExecuteAsync(IConsole console) image

Hamsterman commented 10 months ago

Does this solve it ?

./EpicPrefill clear-cache

2nd option is to delete the Config/userAccount.json file (if the credentials are old you will get an error)

tpill90 commented 4 months ago

This issue is being caused by having both SteamPrefill and EpicPrefill in the same directory. It would probably also be caused by BattlenetPrefill being in the same dir as well.

All of the prefills expect to be the only executable in their directory, so they are conflicting over the Config dir which has similarly named files. The fix for the time being would be to make sure that you have all the prefills in their own folders, and then go and select-apps again.

I do think however that this issue is popping up because it is unintuitive that the prefills should be kept in separate directories to avoid conflicts. I don't have any sort of ideas on how to mitigate this issue without affecting existing installs, but I'll keep this in mind to see if I come up with something at some point.

tkrusterholz commented 4 months ago

Yes this was mitigated by putting each prefill in its own folder. I think that is an acceptable answer so I'll move to close this.