Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.7.8 error Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array #481

Closed
Bladestar2105 opened this issue Jan 26, 2025 · 13 comments · Fixed by #482 or #485
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Bladestar2105
Copy link

Bladestar2105 commented Jan 26, 2025

Hello,

with the newest version I get this error after Library Scan:

"Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
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 gaseous_server.Classes.SignatureManagement._GetSignature(String sqlWhere, String searchString) in /App/gaseous-server/Classes/SignatureManagement.cs:line 79
at gaseous_server.Classes.SignatureManagement.GetSignature(String md5, String sha1) in /App/gaseous-server/Classes/SignatureManagement.cs:line 13
at gaseous_server.Classes.FileSignature._GetFileSignatureFromDatabase(hashObject hash, String ImageName, String ImageExtension, Int64 ImageSize, String GameFileImportPath) in /App/gaseous-server/Classes/FileSignature.cs:line 226
at gaseous_server.Classes.FileSignature._GetFileSignature(hashObject hash, String ImageName, String ImageExtension, Int64 ImageSize, String GameFileImportPath, Boolean IsInZip) in /App/gaseous-server/Classes/FileSignature.cs:line 182
at gaseous_server.Classes.FileSignature.GetFileSignature(LibraryItem library, hashObject hash, FileInfo fi, String GameFileImportPath) in /App/gaseous-server/Classes/FileSignature.cs:line 19
at gaseous_server.Classes.ImportGame.LibrarySpecificScan(LibraryItem library) in /App/gaseous-server/Classes/ImportGames.cs:line 655
at gaseous_server.ProcessQueue.QueueItem.Execute() in /App/gaseous-server/ProcessQueue.cs:line 337"

@michael-j-green michael-j-green self-assigned this Jan 26, 2025
@michael-j-green michael-j-green added the bug Something isn't working label Jan 26, 2025
@michael-j-green michael-j-green added this to the v1.7.8 milestone Jan 26, 2025
@michael-j-green
Copy link
Member

Thanks for that... I'm doing some testing at my end, but wondered if you could help me narrow it down. If you look at the surrounding logs, does it indicate which ROM it failed on? If so, would you be able to provide the full file name and hash?

@michael-j-green michael-j-green removed this from the v1.7.8 milestone Jan 27, 2025
@Bladestar2105
Copy link
Author

These are the full log lines.

20250127 064213: Information: Library Scan: Starting worker process for library Retrogames
20250127 064243: Information: Timered Event: Total TempCleanup run time = 0
20250127 064243: Information: Library Scan: Starting scan of library: Default
20250127 064243: Information: Library Scan: Looking for duplicate library files to clean up
20250127 064243: Information: Library Scan: Checking library files exist on disk
20250127 064243: Information: Library Scan: Looking for orphaned library files to add
20250127 064243: Information: Library Scan: Library scan completed
20250127 064243: Information: Timered Event: Total LibraryScanWorker run time = 0.01
20250127 064243: Information: Library Scan: Starting scan of library: Retrogames
20250127 064243: Information: Hash File: Generating MD5 hash for file: /games/Sega Master System/After Burner (UE) [!].sms
20250127 064243: Information: Hash File: Generating SHA1 hash for file: /games/Sega Master System/After Burner (UE) [!].sms
20250127 064243: Information: Hash File: Generating MD5 hash for file: /games/Sega Master System/Ace of Aces (UE) [!].sms
20250127 064243: Information: Hash File: Generating SHA1 hash for file: /games/Sega Master System/Ace of Aces (UE) [!].sms
20250127 064243: Information: Library Scan: Orphaned file found in library: /games/Sega Master System/Ace of Aces (UE) [!].sms
20250127 064243: Information: Get Signature: Getting signature for file: /games/Sega Master System/Ace of Aces (UE) [!].sms
20250127 064243: Information: Import Game: Checking signature for file: /games/Sega Master System/Ace of Aces (UE) [!].sms
MD5 hash: ce26b4372655f35f1b7c9d0c3b700f93
SHA1 hash: 08a79905767b8e5af8a9c9c232342e6c47588093
20250127 064243: Information: Get Signature: Checking local database for MD5: ce26b4372655f35f1b7c9d0c3b700f93
20250127 064243: Warning: Timered Event: An error occurred
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
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 gaseous_server.Classes.SignatureManagement._GetSignature(String sqlWhere, String searchString) in /App/gaseous-server/Classes/SignatureManagement.cs:line 79
at gaseous_server.Classes.SignatureManagement.GetSignature(String md5, String sha1) in /App/gaseous-server/Classes/SignatureManagement.cs:line 13
at gaseous_server.Classes.FileSignature._GetFileSignatureFromDatabase(hashObject hash, String ImageName, String ImageExtension, Int64 ImageSize, String GameFileImportPath) in /App/gaseous-server/Classes/FileSignature.cs:line 226
at gaseous_server.Classes.FileSignature._GetFileSignature(hashObject hash, String ImageName, String ImageExtension, Int64 ImageSize, String GameFileImportPath, Boolean IsInZip) in /App/gaseous-server/Classes/FileSignature.cs:line 182
at gaseous_server.Classes.FileSignature.GetFileSignature(LibraryItem library, hashObject hash, FileInfo fi, String GameFileImportPath) in /App/gaseous-server/Classes/FileSignature.cs:line 19
at gaseous_server.Classes.ImportGame.LibrarySpecificScan(LibraryItem library) in /App/gaseous-server/Classes/ImportGames.cs:line 655
at gaseous_server.ProcessQueue.QueueItem.Execute() in /App/gaseous-server/ProcessQueue.cs:line 337
20250127 064243: Information: Timered Event: Total LibraryScanWorker run time = 0.05

@michael-j-green michael-j-green linked a pull request Jan 27, 2025 that will close this issue
@michael-j-green michael-j-green added this to the 1.7.8.1 milestone Jan 27, 2025
@michael-j-green
Copy link
Member

michael-j-green commented Jan 27, 2025

@Bladestar2105: Would you be able to update to v1.7.9-preview.1? It will cause all DATs to be reimported. On the settings page, you should see the "Signature Ingestor" process running.

Once completed, would you then be able to manually run the Rematcher service, and let me know if you get any errors again?

@Bladestar2105
Copy link
Author

With the updated version it works fine!

@michael-j-green
Copy link
Member

Great news! :) Thanks for the feedback!

I'll push a full release by the end of (my) day.

@Bladestar2105
Copy link
Author

There is another error now with updated version 1.7.9.

20250128 150026: Information: Hash File: Generating MD5 hash for file: /games/Sega Master System/California Games 2 (UE) [!].sms
20250128 150026: Information: Hash File: Generating SHA1 hash for file: /games/Sega Master System/California Games 2 (UE) [!].sms
20250128 150026: Information: Library Scan: Orphaned file found in library: /games/Sega Master System/California Games 2 (UE) [!].sms
20250128 150026: Information: Get Signature: Getting signature for file: /games/Sega Master System/California Games 2 (UE) [!].sms
MD5 hash: 5ac58b3a7fda23161ab1185b3ee797ac
20250128 150026: Information: Import Game: Checking signature for file: /games/Sega Master System/California Games 2 (UE) [!].sms
SHA1 hash: 5c7d99ba54caf9a674328df787a89e0ab4730de8
20250128 150026: Information: Get Signature: Checking local database for MD5: 5ac58b3a7fda23161ab1185b3ee797ac
20250128 150026: Warning: Timered Event: An error occurred
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
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 gaseous_server.Classes.SignatureManagement._GetSignature(String sqlWhere, String searchString) in /App/gaseous-server/Classes/SignatureManagement.cs:line 79
at gaseous_server.Classes.SignatureManagement.GetSignature(String md5, String sha1) in /App/gaseous-server/Classes/SignatureManagement.cs:line 13
at gaseous_server.Classes.FileSignature._GetFileSignatureFromDatabase(hashObject hash, String ImageName, String ImageExtension, Int64 ImageSize, String GameFileImportPath) in /App/gaseous-server/Classes/FileSignature.cs:line 226
at gaseous_server.Classes.FileSignature._GetFileSignature(hashObject hash, String ImageName, String ImageExtension, Int64 ImageSize, String GameFileImportPath, Boolean IsInZip) in /App/gaseous-server/Classes/FileSignature.cs:line 182
at gaseous_server.Classes.FileSignature.GetFileSignature(LibraryItem library, hashObject hash, FileInfo fi, String GameFileImportPath) in /App/gaseous-server/Classes/FileSignature.cs:line 19
at gaseous_server.ProcessQueue.QueueItem.Execute() in /App/gaseous-server/ProcessQueue.cs:line 337
at gaseous_server.Classes.ImportGame.LibrarySpecificScan(LibraryItem library) in /App/gaseous-server/Classes/ImportGames.cs:line 655
20250128 150026: Information: Timered Event: Total LibraryScanWorker run time = 6.39
20250128 150050: Information: Timered Event: Total LibraryScan run time = 60.01
20250128 150050: Information: Library Scan: Library scan complete. All workers stopped

@michael-j-green
Copy link
Member

Ok, looks like it's the same error. Leave it with me.

@michael-j-green michael-j-green modified the milestones: 1.7.9, 1.7.10 Jan 30, 2025
@michael-j-green michael-j-green linked a pull request Jan 30, 2025 that will close this issue
@michael-j-green
Copy link
Member

michael-j-green commented Jan 30, 2025

Hi @Bladestar2105; so it looks like the issue is around loading the attributes the come from the DAT's when loading a list of ROMs, or an individual ROM.

I'm not able to replicate it myself, but it appears to be around a badly formatted entry in the ROMs table.

The fix I've applied in v1.7.10-preview.1 (released just a few minutes ago) is to wrap loading the attributes in a try/catch. An error will still be logged (with some more detailed error messaging), but it shouldn't cause any issues anymore other than an extra log message.

Would you be able to install v1.7.10-preview.1 and try loading those effected ROMs again?

Edit: if you see the new error message, would you be able to send it through to me? I'd be interested to see what's in your database to see what needs to be fixed to permanently resolve this error.

@Bladestar2105
Copy link
Author

Okay now it seems that it crashes:

2025-01-31 07:47:07,150 WARN exited: gaseous-server (terminated by SIGKILL; not expected)
2025-01-31 7:47:07 5 [Warning] Aborted connection 5 to db: 'gaseous' user: 'root' host: 'localhost' (Got an error reading communication packets)
2025-01-31 7:47:07 6 [Warning] Aborted connection 6 to db: 'gaseous' user: 'root' host: 'localhost' (Got an error reading communication packets)
2025-01-31 7:47:07 7 [Warning] Aborted connection 7 to db: 'gaseous' user: 'root' host: 'localhost' (Got an error reading communication packets)
2025-01-31 7:47:07 4 [Warning] Aborted connection 4 to db: 'gaseous' user: 'root' host: 'localhost' (Got an error reading communication packets)
2025-01-31 07:47:07,176 INFO spawned: 'gaseous-server' with pid 421
20250131 064707: Information: Startup: Starting Gaseous Server 1.7.10.0
Running in Docker - setting configuration from variables

@michael-j-green
Copy link
Member

Is Gaseous server just endless restarting is it?

Nothing I changed in this preview build should have caused that to happen.

Is the database container still running?

Can you post your compose file?

When you performed the update to the preview, how did you apply it? Could you try docker compose pull && docker compose down && docker compose up -d to tear down all of the containers and recreate them from scratch (your data will be safe).

@Bladestar2105
Copy link
Author

Nevermind, it works now. In the folder with the ROMs I also had the BIOSes. I think this was causing the error. 😄

@michael-j-green
Copy link
Member

That's good to hear :)

Are you ok with closing this issue? If so, I'll release this current preview.

@Bladestar2105
Copy link
Author

Fixed and closed 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants