JosefNemec/Playnite · error · Exception

Emulator not found.

Error message

Emulator not found.

What it means

Thrown by GenericGameController.StartEmulator when database.Emulators[action.EmulatorId] returns null — i.e. no Emulator record exists with the given id. It is a bare Exception before any profile handling occurs.

Source

Thrown at source/Playnite/Controllers/GenericGameController.cs:77

            IPlayniteAPI playniteApi) : base(game)
        {
            execContext = SynchronizationContext.Current;
            database = db;
            this.scriptRuntime = scriptRuntime;
            this.playniteApi = playniteApi;
        }

        public override void Play(PlayActionArgs args)
        {
            throw new NotSupportedException("This shouldn't be called.");
        }

        public void StartEmulator(EmulationPlayAction action, bool asyncExec, OnGameStartingEventArgs startingArgs)
        {
            var emulator = database.Emulators[action.EmulatorId];
            if (emulator == null)
            {
                throw new Exception("Emulator not found.");
            }

            currentEmuProfile = null;
            if (action.SelectedEmulatorProfile is CustomEmulatorProfile customProfile)
            {
                currentEmuProfile = customProfile;
            }
            else if (action.SelectedEmulatorProfile is BuiltInEmulatorProfile builtinProfile)
            {
                currentEmuProfile = builtinProfile;
            }
            else
            {
                throw new Exception("Uknown play action configuration.");
            }

            emulator = emulator.GetClone();
            if (!emulator.InstallDir.IsNullOrEmpty())

View on GitHub (pinned to 5911f4e964)

Solutions

  1. Validate database.Emulators.Contains(action.EmulatorId) before calling StartEmulator.
  2. Re-select the emulator in the game's play action so the id is current.
  3. If the emulator was removed, recreate it or pick a different one.
  4. Repair/restore the game database if ids are inconsistent.

Example fix

// before
controller.StartEmulator(action, asyncExec, args);

// after — validate emulator existence first
if (!database.Emulators.Contains(action.EmulatorId))
{
    dialogs.ShowMessage("The emulator for this game no longer exists. Please re-select it.");
    return;
}
controller.StartEmulator(action, asyncExec, args);
Defensive patterns

Strategy: validation

Validate before calling

if (!database.Emulators.Contains(action.EmulatorId)) throw new InvalidOperationException($"Emulator {action.EmulatorId} not found");

Type guard

static bool EmulatorExists(IGameDatabase db, Guid id) => db.Emulators.Contains(id) && db.Emulators[id] != null;

Try / catch

try { controller.StartEmulator(action, asyncExec, args); }
catch (Exception ex) when (database.Emulators[action.EmulatorId] == null) { dialogs.ShowMessage("Emulator no longer exists. Re-select it."); }

Prevention

When it happens

Trigger: Launching a game whose play action references an EmulatorId that was deleted; id mismatch after a database migration/restore; action created against an emulator since removed; corrupted DB where the lookup returns null.

Common situations: User deleted or re-added an emulator so the stored EmulatorId is stale; imported library referencing a missing emulator; manual edit of game action EmulatorId.

Related errors


AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13). Data as JSON: /api/errors/6cc141d8c1549238. Report an issue: GitHub.