JosefNemec / Playnite

Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games.
https://playnite.link
MIT License
9.15k stars 494 forks source link

Database update failed : Database must be migrated before opening #2744

Closed AlexandreJadin closed 2 years ago

AlexandreJadin commented 2 years ago

Bug Description

Hello,

I recently updated Playnite to version 9.14

After the update, upon startup of the program I have the following error pop-ups

image

image

Which can be translated to:

"database update failed"

"Unable to open library database Database must be migrated before opening"

I have uninstalled and reboot the computer and re-installed playnite without seeing improvements (even launching in safe mode)

I am also joining the playnite.log file it seems to contain errors related to the issue (line 27010) playnite.log

Is there a way to fix this issue and re-open the database with minimal loss? Which file would help?

Thank you in advance


04-01 18:59:50.637|ERROR|PlayniteApplication:Failed to migrate database to new version.
LiteDB.LiteException: Cannot insert duplicate key in unique index '_id'. The duplicate value is '{"$guid":"067765b0-94b4-4f5d-bb0d-b7db4f06f8a5"}'.
   à LiteDB.IndexService.AddNode(CollectionIndex index, BsonValue key, Byte level, IndexNode last)
   à LiteDB.IndexService.AddNode(CollectionIndex index, BsonValue key, IndexNode last)
   à LiteDB.LiteEngine.InsertDocument(CollectionPage col, BsonDocument doc, BsonType autoId)
   à LiteDB.LiteEngine.<>c__DisplayClass22_0.<Insert>b__0(CollectionPage col)
   à LiteDB.LiteEngine.Transaction[T](String collection, Boolean addIfNotExists, Func`2 action)
   à LiteDB.LiteEngine.Insert(String collection, IEnumerable`1 docs, BsonType autoId)
   à LiteDB.LiteEngine.Insert(String collection, BsonDocument doc, BsonType autoId)
   à LiteDB.LiteCollection`1.Insert(T document)
   à Playnite.Database.GameDatabase.<>c__DisplayClass280_0.<MigrateNewDatabaseFormat>g__convertList|3[TOld,TNew](String dir, Action`2 propertyMapper) dans C:\projects\playnite\source\Playnite\Database\GameDatabaseMigration.cs:ligne 221
   à Playnite.Database.GameDatabase.MigrateNewDatabaseFormat(String databasePath) dans C:\projects\playnite\source\Playnite\Database\GameDatabaseMigration.cs:ligne 392
   à Playnite.PlayniteApplication.<MigrateDatabase>b__133_0(GlobalProgressActionArgs _) dans C:\projects\playnite\source\Playnite\App\PlayniteApplication.cs:ligne 1105
   à Playnite.ViewModels.ProgressViewViewModel.<ActivateProgress>b__31_0() dans C:\projects\playnite\source\Playnite\ViewModels\ProgressViewViewModel.cs:ligne 122

To Reproduce

No response

Diagnostics ID

71786335-a947-4afe-bb36-85b6606956b6

Screenshots

No response

JosefNemec commented 2 years ago

Did you modify database library files directly when on old version? Because this only happens if some changes to library files were made outside of Playnite.

Go to C:\Users\Alexandre Jadin\AppData\Roaming\Playnite\, zip and upload library folder, I'll try to repair it. You can exclude files subfolder, which could be large and I don't need it.

AlexandreJadin commented 2 years ago

Here it is

library.zip

Never modified this manually outside the program though, I possibly had some extensions, will try to find which in a backup

JosefNemec commented 2 years ago

Here's migrated library. There were two games I had to remove because they had corrupted (duplicated) data. They were definitely modified by some 3rd party.

AlexandreJadin commented 2 years ago

Worked like a charm, thank you!