JosefNemec/Playnite · error · Exception
{directory} not found.
Error message
{directory} not found. What it means
Thrown as a generic Exception by Emulation.GetExecutable when the directory parameter does not exist on the filesystem. GetExecutable recursively enumerates files in the directory to match against the emulator profile's StartupExecutable regex, so a non-existent directory is a hard precondition failure.
Source
Thrown at source/Playnite/Emulators/Emulation.cs:210
}
public static bool IsEmuProfileValid(SDK.Models.Emulator emulator, string profileId)
{
if (profileId.StartsWith(SDK.Models.CustomEmulatorProfile.ProfilePrefix))
{
return emulator.CustomProfiles?.Any(a => a.Id == profileId) == true;
}
else
{
return GetProfile(emulator.BuiltInConfigId, profileId) != null;
}
}
public static string GetExecutable(string directory, EmulatorDefinitionProfile profile, bool relative)
{
if (!Directory.Exists(directory))
{
throw new Exception($"{directory} not found.");
}
var fileEnumerator = new SafeFileEnumerator(directory, "*.*", SearchOption.AllDirectories);
foreach (var file in fileEnumerator)
{
if (file.Attributes.HasFlag(FileAttributes.Directory))
{
continue;
}
var relativePath = file.FullName.Replace(Path.GetDirectoryName(file.FullName), "").Trim(Path.DirectorySeparatorChar);
var regex = new Regex(profile.StartupExecutable, RegexOptions.IgnoreCase);
if (regex.IsMatch(relativePath))
{
if (relative)
{
return relativePath;
}
View on GitHub (pinned to 5911f4e964)
Solutions
- Verify the emulator's InstallDir in Playnite emulator settings points to a valid existing directory.
- If the emulator is on a removable/network drive, ensure it is connected before launching games.
- Re-detect the emulator install location using Playnite's emulator configuration wizard.
- If the emulator is no longer installed, reinstall it or update the InstallDir.
- Add a Directory.Exists check before calling GetExecutable in custom code.
Example fix
// before — calling GetExecutable without verifying directory
var exe = Emulation.GetExecutable(emulator.InstallDir, profile, true); // throws if dir missing
// after — validate first
if (!Directory.Exists(emulator.InstallDir))
{
logger.Error($"Emulator install directory not found: {emulator.InstallDir}");
return null;
}
var exe = Emulation.GetExecutable(emulator.InstallDir, profile, true); Defensive patterns
Strategy: validation
Validate before calling
if (!Directory.Exists(emulator.InstallDir))
{
logger.Error($"Emulator install directory not found: {emulator.InstallDir}");
return null;
} Type guard
static bool IsValidEmulatorDirectory(string directory)
{
return !directory.IsNullOrEmpty() && Directory.Exists(directory);
} Prevention
- Verify emulator InstallDir exists after every emulator configuration change.
- Prompt users to re-detect the emulator if InstallDir is missing at launch time.
- Store and validate emulator paths in the settings UI with a 'Browse' and 'Test' button.
When it happens
Trigger: Calling Emulation.GetExecutable(directory, profile, relative) where Directory.Exists(directory) is false. The directory parameter is typically emulator.InstallDir, which may be unset, stale, or point to an uninstalled/moved emulator.
Common situations: The emulator was uninstalled but its InstallDir in Playnite still points to the old location. The emulator is on a removable drive or network share that is not currently mounted. The InstallDir was never set correctly (empty string or default placeholder). The emulator was moved to a different folder manually.
Related errors
- Source directory does not exist or could not be found: {sour
- Root directory is not set or does not exist.
- 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/159197a24b3885ae.
Report an issue: GitHub.