The .mpr cannot be opened after restart (KeyNotFoundException)

0
Sequence:1. I used Maia to create a Microflow.2. Threw a JSON-related error and then became unresponsive.3. After restarting Studio Pro, the project .mpr could no longer be opened.The project now fails with:System.Collections.Generic.KeyNotFoundException: The given key '067a9791-b96d-454c-a5bc-e3db28bdb323' was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Mendix.Modeler.Storage.Operations.UnitLoader.<>c__DisplayClass17_0.<LoadUnits>b__0(IMprUnitData unitData) in Mendix.Modeler.Storage\Operations\UnitLoader.cs:line 172 at Mendix.Modeler.Storage.Mpr.Storage.MprUnitRepositoryBase.ExecuteLoadCommand(IDbCommand command, Boolean loadContents, Action`1 handleUnitData) in Mendix.Modeler.Storage\Mpr\Storage\MprUnitRepositoryBase.cs:line 197 at Mendix.Modeler.Storage.Mpr.Storage.MprUnitRepositoryBase.LoadUnitsBatched(IEnumerable`1 unitIDs, Boolean loadContents, Action`1 handleUnitData) in Mendix.Modeler.Storage\Mpr\Storage\MprUnitRepositoryBase.cs:line 180 at Mendix.Modeler.Storage.Mpr.Storage.MprUnitRepositoryBase.LoadUnits(UnitQuery unitQuery, Boolean loadContents, Action`1 handleUnitData) in Mendix.Modeler.Storage\Mpr\Storage\MprUnitRepositoryBase.cs:line 130 at Mendix.Modeler.Storage.Operations.UnitLoader.LoadUnits(IStorageUnit unit, IEnumerable`1 unitIDs) in Mendix.Modeler.Storage\Operations\UnitLoader.cs:line 163 at Mendix.Modeler.Storage.Operations.UnitLoader.LoadChildUnits(IStorageUnit unit) in Mendix.Modeler.Storage\Operations\UnitLoader.cs:line 126 at Mendix.Modeler.Storage.Operations.UnitLoader.LoadChildUnits(IStorageUnit unit) in Mendix.Modeler.Storage\Operations\UnitLoader.cs:line 156 at Mendix.Modeler.Storage.Operations.UnitLoader.<>c__DisplayClass12_0`1.<Load>b__1() in Mendix.Modeler.Storage\Operations\UnitLoader.cs:line 45 at Mendix.Modeler.Undo.GlobalTransactionManager.<>c__DisplayClass22_0.<JustDo>b__0() in Mendix.Modeler.Undo\GlobalTransactionManager.cs:line 150 at Mendix.Modeler.Undo.GlobalTransactionManager.JustDo[T](Func`1 action) in Mendix.Modeler.Undo\GlobalTransactionManager.cs:line 169 at Mendix.Modeler.Undo.GlobalTransactionManager.JustDo(Action action) in Mendix.Modeler.Undo\GlobalTransactionManager.cs:line 148 at Mendix.Modeler.Storage.Operations.UnitLoader.Load[T](IProgressInfo info, Dictionary`2 _knownUnits) in Mendix.Modeler.Storage\Operations\UnitLoader.cs:line 42 at Mendix.Modeler.Storage.Database.Load[T](IProgressInfo info, Dictionary`2 knownUnits, Boolean throwOnUnknownObjects) in Mendix.Modeler.Storage\Database.cs:line 50 at Mendix.Modeler.Operations.ProjectFileLoader.<>c__DisplayClass3_0.<Load>b__0(IDatabase database) in Mendix.Modeler.Core\Operations\ProjectFileLoader.cs:line 32 at Mendix.Modeler.Storage.DatabaseManager.<>c__DisplayClass12_0`1.<Do>b__0(IMprStorageService mprStorageService) in Mendix.Modeler.Storage\DatabaseManager.cs:line 70 at Mendix.Modeler.Storage.Mpr.Storage.MprStorageManager.PerformAction[T](String mprFilePath, Func`2 action, IMprStorageService mprStorageService, IDbConnector connector, String loggingId) in Mendix.Modeler.Storage\Mpr\Storage\MprStorageManager.cs:line 235 at Mendix.Modeler.Storage.Mpr.Storage.MprStorageManager.Do[T](String mprFilePath, Func`2 action, Boolean doCheckForV2, Boolean readOnly) in Mendix.Modeler.Storage\Mpr\Storage\MprStorageManager.cs:line 170 at Mendix.Modeler.Storage.Mpr.Storage.MprStorageManager.Do[T](String mprFilePath, Func`2 action) in Mendix.Modeler.Storage\Mpr\Storage\MprStorageManager.cs:line 109 at Mendix.Modeler.Storage.DatabaseManager.Do[TResult](String filePath, Func`2 action) in Mendix.Modeler.Storage\DatabaseManager.cs:line 70 at Mendix.Modeler.Operations.ProjectFileLoader.Load(IProgressInfo info, String filePath, Boolean debugLogEnabled) in Mendix.Modeler.Core\Operations\ProjectFileLoader.cs:line 26
asked
1 answers
1

Hi,


This error indicates that the .mpr file has become inconsistent/corrupted, most likely during the Maia-generated microflow creation where Studio Pro became unresponsive.

The KeyNotFoundException during UnitLoader typically means:

  • A model unit (microflow/object) is referenced
  • But the actual data is missing or partially written in the .mpr (SQLite DB)

What likely happened

When Studio Pro crashed:

  • The microflow (or related JSON structure) was partially saved
  • Internal references (GUIDs) got out of sync
  • On restart, Studio Pro cannot resolve the missing unit → throws this error

recovery steps

1. Restore from Team Server (best option)

If your project is version controlled:

  • Open Studio Pro
  • Go to Version Control → Download from Team Server
  • Select the latest working revision

This is the safest and most reliable fix.

2. Restore from backup (.mpr.bak)

Check your project folder for:

projectname.mpr.bak

  • Rename it to .mpr
  • Open again

3. Use local version history (if enabled)

If you had local history:

  • Restore previous version of the .mpr

4. Last resort (manual DB recovery – risky)

Since .mpr is a SQLite DB:

  • Open it using a SQLite tool
  • Look for broken references in tables like Unit / Object

But this is not recommended unless you know the internal structure.

Important note about Maia

Maia is still evolving, and if Studio Pro becomes unresponsive during generation:

  • It can leave the model in a partially written state
  • Always commit before using Maia for major changes

Prevention going forward

  • Commit frequently (before using Maia)
  • Enable auto-backups
  • Avoid force-closing Studio Pro during model changes


This is not a normal modeling issue but a model corruption caused by an interrupted write operation. The correct fix is to restore a previous working version (Team Server or backup) rather than trying to repair the .mpr manually.


answered