JosefNemec/Playnite · error · FileNotFoundException

Emulator executable not found. Regular expression lookup: {

Error message

Emulator executable not found.

Regular expression lookup: {profileDef.StartupExecutable}

What it means

Thrown as FileNotFoundException when a built-in emulator profile's StartupExecutable regex pattern fails to match any file inside the emulator's InstallDir. The controller calls Emulation.GetExecutable() which recursively enumerates all files under InstallDir and applies the profile's StartupExecutable regex; if no file matches, it returns null/empty and this error fires. The message includes the offending regex so the developer can see exactly what pattern failed.

Source

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

                        $"{emulator.Name} runtime for {Game.Name}",
                        Emulation.GetStartupScriptPath(def),
                        emulator.InstallDir,
                        new Dictionary<string, object>
                        {
                            { "Emulator", emulator.GetClone() },
                            { "EmulatorProfile", profileDef.GetClone() },
                            { "RomPath", romPath }
                        },
                        asyncExec);
                }
                else
                {
                    builtIn = builtIn.GetClone();
                    startupDir = emulator.InstallDir;
                    startupPath = Emulation.GetExecutable(emulator.InstallDir, profileDef, true);
                    if (startupPath.IsNullOrEmpty())
                    {
                        throw new FileNotFoundException(ResourceProvider.GetString(LOC.ErrorEmulatorExecutableNotFound) +
                            $"\n\nRegular expression lookup: {profileDef.StartupExecutable}");
                    }

                    if (action.OverrideDefaultArgs)
                    {
                        startupArgs = Game.ExpandVariables(action.Arguments, false, emulator.InstallDir, romPath);
                    }
                    else
                    {
                        if (builtIn.OverrideDefaultArgs)
                        {
                            startupArgs = Game.ExpandVariables(builtIn.CustomArguments, false, emulator.InstallDir, romPath);
                        }
                        else
                        {
                            startupArgs = Game.ExpandVariables(profileDef.StartupArguments, false, emulator.InstallDir, romPath);
                        }

View on GitHub (pinned to 5911f4e964)

Solutions

  1. Verify the emulator InstallDir is correct: open the emulator settings in Playnite and confirm the installation path points to the folder containing the real executable.
  2. Check the regex pattern from the error message against the actual files in InstallDir: list files recursively and test if any match the StartupExecutable regex.
  3. Update Playnite or the emulator definitions pack: a stale definition with an outdated regex is the most common cause after an emulator version bump.
  4. Switch the game's emulator profile to a custom profile where you specify the exact executable path instead of relying on the built-in regex.
  5. Reinstall or re-detect the emulator so its InstallDir reflects the current file layout.

Example fix

// before — relying on built-in regex match that no longer works
startupPath = Emulation.GetExecutable(emulator.InstallDir, profileDef, true);
if (startupPath.IsNullOrEmpty())
{
    throw new FileNotFoundException(ResourceProvider.GetString(LOC.ErrorEmulatorExecutableNotFound) +
        $"\n\nRegular expression lookup: {profileDef.StartupExecutable}");
}

// after — user switches to a custom emulator profile with an explicit path
// Configure the game to use a CustomEmulatorProfile with ExecutablePath set to the verified .exe location.
Defensive patterns

Strategy: validation

Validate before calling

string exe = Emulation.GetExecutable(emulator.InstallDir, profileDef, false);
if (exe.IsNullOrEmpty())
{
    logger.Warn($"No executable matching '{profileDef.StartupExecutable}' in {emulator.InstallDir}.");
    return; // or prompt user to reconfigure
}

Type guard

static bool IsValidEmulatorExecutable(string installDir, EmulatorDefinitionProfile profile)
{
    return Directory.Exists(installDir) &&
           !Emulation.GetExecutable(installDir, profile, false).IsNullOrEmpty();
}

Try / catch

try
{
    controller.Start(action, true, startingArgs);
}
catch (FileNotFoundException ex) when (ex.Message.Contains("Regular expression lookup"))
{
    logger.Error($"Emulator executable regex failed: {ex.Message}");
    Dialogs.ShowMessage("The emulator executable was not found. Please check the emulator installation path and profile settings.");
}

Prevention

When it happens

Trigger: Calling Start on a game whose play action is a built-in emulator profile (BuiltInEmulatorProfile), where the emulator InstallDir contains files but none match the profileDef.StartupExecutable regex pattern. Occurs in GenericGameController when profileDef.ScriptStartup is false and the non-script code path executes (line 184).

Common situations: The emulator was updated and its executable was renamed (e.g., retroarch.exe moved or versioned). The emulator InstallDir is wrong (points to a launcher/updater folder, not the real install). The built-in emulator definition's StartupExecutable regex is stale after an emulator update. A portable emulator was installed to a different subdirectory than the definition expects.

Related errors


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