{"record":{"id":"5d197e1a442fdfeb","repo":"JosefNemec/Playnite","slug":"uknown-play-action-configuration","errorCode":null,"errorMessage":"Uknown play action configuration.","messagePattern":"Uknown play action configuration\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/Controllers/GenericGameController.cs","lineNumber":91,"sourceCode":"        {\r\n            var emulator = database.Emulators[action.EmulatorId];\r\n            if (emulator == null)\r\n            {\r\n                throw new Exception(\"Emulator not found.\");\r\n            }\r\n\r\n            currentEmuProfile = null;\r\n            if (action.SelectedEmulatorProfile is CustomEmulatorProfile customProfile)\r\n            {\r\n                currentEmuProfile = customProfile;\r\n            }\r\n            else if (action.SelectedEmulatorProfile is BuiltInEmulatorProfile builtinProfile)\r\n            {\r\n                currentEmuProfile = builtinProfile;\r\n            }\r\n            else\r\n            {\r\n                throw new Exception(\"Uknown play action configuration.\");\r\n            }\r\n\r\n            emulator = emulator.GetClone();\r\n            if (!emulator.InstallDir.IsNullOrEmpty())\r\n            {\r\n                emulator.InstallDir = Paths.FixSeparators(emulator.InstallDir.Replace(ExpandableVariables.PlayniteDirectory, PlaynitePaths.ProgramPath));\r\n                emulator.InstallDir = CheckPath(emulator.InstallDir, nameof(emulator.InstallDir), FileSystemItem.Directory);\r\n                emulator.InstallDir = emulator.InstallDir.TrimEnd(Path.DirectorySeparatorChar);\r\n            }\r\n\r\n            StartingArgs = startingArgs;\r\n\r\n            var startupPath = \"\";\r\n            var startupArgs = \"\";\r\n            var startupDir = \"\";\r\n            var romPath = Game.ExpandVariables(action.SelectedRomPath, true, emulator.InstallDir, null);\r\n            // This is later passed to an emulator so it's up to it how it processes long paths.\r\n            romPath = Paths.TrimLongPathPrefix(CheckPath(romPath, \"ROM\", FileSystemItem.File));\r","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Controllers/GenericGameController.cs#L73-L109","documentation":"Thrown by GenericGameController.StartEmulator when action.SelectedEmulatorProfile is neither a CustomEmulatorProfile nor a BuiltInEmulatorProfile (the two recognized types). It is a bare Exception ('Uknown' is a typo for 'Unknown') indicating an unrecognized profile kind on the play action.","triggerScenarios":"A play action whose SelectedEmulatorProfile is null or an unexpected subtype (schema change, plugin-supplied profile type, or deserialization into a base/incompatible type).","commonSituations":"Database schema/plugin version mismatch producing a profile of an unexpected type; action authored by an older/newer version; null profile after a partial DB edit.","solutions":["Check action.SelectedEmulatorProfile is one of the two supported types before launching.","Re-select or recreate the emulator profile on the game's play action.","Update Playnite/plugins so profile types align with the installed version.","Repair the game database if the profile field is corrupted."],"exampleFix":"// before\ncontroller.StartEmulator(action, asyncExec, args);\n\n// after — type-check the profile before launching\nvar p = action.SelectedEmulatorProfile;\nif (!(p is CustomEmulatorProfile) && !(p is BuiltInEmulatorProfile))\n{\n    dialogs.ShowMessage(\"The emulator profile for this game is invalid. Please reconfigure it.\");\n    return;\n}\ncontroller.StartEmulator(action, asyncExec, args);","handlingStrategy":"type-guard","validationCode":"var p = action.SelectedEmulatorProfile;\nif (!(p is CustomEmulatorProfile) && !(p is BuiltInEmulatorProfile)) throw new InvalidOperationException(\"Unsupported profile type\");","typeGuard":"static bool IsKnownProfile(EmulatorProfile p) => p is CustomEmulatorProfile || p is BuiltInEmulatorProfile;","tryCatchPattern":"try { controller.StartEmulator(action, asyncExec, args); }\ncatch (Exception ex) when (!(action.SelectedEmulatorProfile is CustomEmulatorProfile || action.SelectedEmulatorProfile is BuiltInEmulatorProfile)) { dialogs.ShowMessage(\"Invalid emulator profile. Reconfigure it.\"); }","preventionTips":["Type-check the profile before launching.","Re-select profiles after Playnite/plugin version changes.","Repair the database when profile fields are corrupted."],"tags":["emulator","validation","type-check","game-controller","playnite"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}