{"record":{"id":"bba1e821092e1996","repo":"JosefNemec/Playnite","slug":"emulator-startup-script-not-found","errorCode":null,"errorMessage":"Emulator startup script not found.","messagePattern":"Emulator startup script not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"source/Playnite/Controllers/GenericGameController.cs","lineNumber":165,"sourceCode":"                    startupDir = expandedProfile.WorkingDirectory;\r\n                    startupPath = expandedProfile.Executable;\r\n                    StartEmulatorProcess(startupPath, startupArgs, startupDir, emulator.InstallDir, romPath, asyncExec, emulator.GetClone(), expandedProfile.GetClone(), expandedProfile.TrackingMode, expandedProfile.TrackingPath);\r\n                }\r\n            }\r\n            else if (currentEmuProfile is BuiltInEmulatorProfile builtIn)\r\n            {\r\n                var profileDef = Emulation.GetProfile(emulator.BuiltInConfigId, builtIn.BuiltInProfileName);\r\n                if (profileDef == null)\r\n                {\r\n                    throw new Exception($\"Can't find built-in {builtIn.BuiltInProfileName} emulator profile.\");\r\n                }\r\n\r\n                if (profileDef.ScriptStartup)\r\n                {\r\n                    var def = Emulation.GetDefition(emulator.BuiltInConfigId);\r\n                    if (def == null || !FileSystem.FileExists(Emulation.GetStartupScriptPath(def)))\r\n                    {\r\n                        throw new FileNotFoundException(ResourceProvider.GetString(LOC.ErrorEmulatorStartupScriptNotFound));\r\n                    }\r\n\r\n                    RunStartScriptFile(\r\n                        $\"{emulator.Name} runtime for {Game.Name}\",\r\n                        Emulation.GetStartupScriptPath(def),\r\n                        emulator.InstallDir,\r\n                        new Dictionary<string, object>\r\n                        {\r\n                            { \"Emulator\", emulator.GetClone() },\r\n                            { \"EmulatorProfile\", profileDef.GetClone() },\r\n                            { \"RomPath\", romPath }\r\n                        },\r\n                        asyncExec);\r\n                }\r\n                else\r\n                {\r\n                    builtIn = builtIn.GetClone();\r\n                    startupDir = emulator.InstallDir;\r","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Controllers/GenericGameController.cs#L147-L183","documentation":"Thrown by GenericGameController.StartEmulator when a built-in profile requires a startup script (profileDef.ScriptStartup true) but Emulation.GetDefition(BuiltInConfigId) is null OR the startup script file at Emulation.GetStartupScriptPath(def) does not exist. It is a FileNotFoundException using a localized resource string (LOC.ErrorEmulatorStartupScriptNotFound).","triggerScenarios":"A built-in profile flagged as needing a startup script, but the supporting definition is missing or its startup script file is absent from disk; the emulator add-on that ships the script was uninstalled/disabled; script file deleted by AV or user cleanup.","commonSituations":"Emulator support add-on removed or corrupted after the profile was configured; portable install missing the script; AV quarantined the startup script; partial Playnite install.","solutions":["Confirm the emulator add-on providing the startup script is installed and enabled.","Verify FileSystem.FileExists(Emulation.GetStartupScriptPath(def)) before launching.","Reinstall/repair the emulator support extension to restore the script.","Restore the script from AV quarantine and exclude the Playnite folder."],"exampleFix":"// before\ncurrentEmuProfile = builtIn;\ncontroller.StartEmulator(action, asyncExec, args);\n\n// after — verify definition + script presence first\nvar def = Emulation.GetDefition(emulator.BuiltInConfigId);\nif (def == null || !FileSystem.FileExists(Emulation.GetStartupScriptPath(def)))\n{\n    dialogs.ShowMessage(\"Emulator startup script is missing. Reinstall the emulator support add-on.\");\n    return;\n}\ncurrentEmuProfile = builtIn;\ncontroller.StartEmulator(action, asyncExec, args);","handlingStrategy":"validation","validationCode":"var def = Emulation.GetDefition(emulator.BuiltInConfigId);\nif (def == null || !FileSystem.FileExists(Emulation.GetStartupScriptPath(def))) throw new FileNotFoundException(\"startup script missing\");","typeGuard":"static bool StartupScriptReady(Emulator e) { var d = Emulation.GetDefition(e.BuiltInConfigId); return d != null && FileSystem.FileExists(Emulation.GetStartupScriptPath(d)); }","tryCatchPattern":"try { controller.StartEmulator(action, asyncExec, args); }\ncatch (FileNotFoundException ex) { logger.Error(ex, \"startup script missing\"); dialogs.ShowMessage(\"Reinstall the emulator support add-on.\"); }","preventionTips":["Keep the emulator support add-on installed and enabled.","Verify the startup script file exists before launching.","Restore the script from AV quarantine and exclude the Playnite folder."],"tags":["emulator","startup-script","filesystem","add-on","game-controller","playnite"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}