JosefNemec/Playnite · error · FileNotFoundException
Emulator executable not found. {path} in {workDir}
Error message
Emulator executable not found.
{path} in {workDir} What it means
Thrown as FileNotFoundException when ProcessStarter.StartProcess raises a Win32Exception with NativeErrorCode 2 (ERROR_FILE_NOT_FOUND) at process launch time. Unlike error 40 which fires before launch (regex match failed), this fires at the OS level: the resolved path existed in theory but Windows could not find the executable when actually spawning the process.
Source
Thrown at source/Playnite/Controllers/GenericGameController.cs:251
startedRomFile = romPath;
startedEmulator = emulator;
startedEmulatorProfile = emuProfile;
startedEmulatorDir = emulatorDir;
if (asyncExec)
{
ExecuteEmulatorScript(currentEmuProfile.PreScript, emulatorDir, romPath, emulator, emuProfile);
Process process = null;
try
{
process = ProcessStarter.StartProcess(path, args, workDir);
}
catch (Win32Exception exc)
{
// 2 is ERROR_FILE_NOT_FOUND
if (exc.NativeErrorCode == 2)
{
throw new FileNotFoundException(LOC.ErrorEmulatorExecutableNotFound.GetLocalized() +
$"\n\n{path} in {workDir}");
}
else
{
throw;
}
}
void gameStarted(int processId)
{
startedEmuProcessId = processId;
ExecuteEmulatorScript(currentEmuProfile.PostScript, emulatorDir, romPath, emulator, emuProfile);
InvokeOnStarted(new GameStartedEventArgs { StartedProcessId = startedEmuProcessId });
}
if (trackingMode == TrackingMode.Default || trackingMode == TrackingMode.Process)
{
gameStarted(process.Id);
View on GitHub (pinned to 5911f4e964)
Solutions
- Verify the executable file exists at the resolved path shown in the error message at the moment of launch.
- Check that the working directory exists: the workDir in the error must be a valid folder.
- If using mapped drives or UNC paths, ensure the network resource is accessible from the Playnite process.
- Temporarily disable anti-virus or add an exclusion for the emulator directory.
- Re-derive the path using Emulation.GetExecutable to get a fresh match, or switch to a custom profile with a hardcoded path.
Example fix
// before — path resolves but OS can't find it at spawn
process = ProcessStarter.StartProcess(path, args, workDir);
// after — validate existence immediately before spawning
if (!File.Exists(path))
throw new FileNotFoundException($"Executable vanished before launch: {path}");
if (!Directory.Exists(workDir))
throw new DirectoryNotFoundException($"Working directory does not exist: {workDir}");
process = ProcessStarter.StartProcess(path, args, workDir); Defensive patterns
Strategy: try-catch
Validate before calling
if (!File.Exists(path) || !Directory.Exists(workDir))
{
logger.Error($"Cannot start: path={path}, workDir={workDir}");
return;
} Try / catch
try
{
process = ProcessStarter.StartProcess(path, args, workDir);
}
catch (Win32Exception ex) when (ex.NativeErrorCode == 2)
{
logger.Error($"File not found at launch: {path} in {workDir}. Ex: {ex.Message}");
// retry with re-resolved path or notify user
} Prevention
- Validate file and directory existence immediately before Process.Start, not just during configuration.
- Pin emulator and game paths to verified locations; avoid paths with environment variables that may resolve differently.
- Monitor for antivirus quarantine of game executables.
When it happens
Trigger: StartEmulatorProcess is called in async mode (asyncExec=true); ProcessStarter.StartProcess(path, args, workDir) internally calls Process.Start and the OS returns ERROR_FILE_NOT_FOUND (Win32 error 2). The path may have been valid when checked but became inaccessible, or the working directory is invalid.
Common situations: The executable was deleted or moved between resolution and launch. The working directory (workDir) does not exist. The path points to a UNC path or mapped drive that became unavailable. A symlink or junction target is broken. Anti-virus quarantined the executable. The path contains environment variables that resolve differently in the process context.
Related errors
- Emulator executable not found. Regular expression lookup: {
- {directory} not found.
- Emulator not found.
- Uknown play action configuration.
- Can't find built-in {builtIn.BuiltInProfileName} emulator pr
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/962567a0384ef880.
Report an issue: GitHub.