{"record":{"id":"2d580aaf4213587b","repo":"JosefNemec/Playnite","slug":"uknown-play-action-type","errorCode":null,"errorMessage":"Uknown play action type.","messagePattern":"Uknown play action type\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"source/Playnite/GamesEditor.cs","lineNumber":398,"sourceCode":"                }\r\n\r\n                if (controller is GenericPlayController genCtrl)\r\n                {\r\n                    if (playAction is EmulationPlayAction emuAct)\r\n                    {\r\n                        genCtrl.StartEmulator(emuAct, true, startingArgs);\r\n                    }\r\n                    else if (playAction is AutomaticPlayController autoAction)\r\n                    {\r\n                        genCtrl.Start(autoAction);\r\n                    }\r\n                    else if (playAction is GameAction act)\r\n                    {\r\n                        genCtrl.Start(act, true, startingArgs);\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new NotSupportedException(\"Uknown play action type.\");\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    controller.Play(new PlayActionArgs());\r\n                }\r\n            }\r\n            catch (Exception exc) when (!PlayniteEnvironment.ThrowAllErrors)\r\n            {\r\n                logger.Error(exc, \"Cannot start game: \");\r\n                Dialogs.ShowMessage(\r\n                    resources.GetString(LOC.GameStartError).Format(exc.Message), LOC.GameError,\r\n                    MessageBoxButton.OK, MessageBoxImage.Error);\r\n                if (controller != null)\r\n                {\r\n                    controllers.RemoveController(controller);\r\n                    UpdateGameState(game.Id, null, null, null, null, false);\r\n                }\r","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/GamesEditor.cs#L380-L416","documentation":"Thrown as NotSupportedException when a game's play controller is a GenericPlayController but the resolved playAction is none of EmulationPlayAction, AutomaticPlayController, or GameAction. It is an exhaustiveness guard: the startup dispatch does not know how to launch that action type through a generic controller.","triggerScenarios":"Starting a game whose controller is GenericPlayController while playAction is a new/unsupported PlayController type or a null/unexpected object. Occurs if a custom extension returns a controller/action combination Playnite's dispatcher was not built to handle.","commonSituations":"An extension defines a custom play action type not covered by the three branches; an SDK/API version mismatch introduced a new action type the runtime cannot dispatch; controller selection logic returned an unexpected type.","solutions":["Ensure the play action is one of the three supported types before invoking StartGame.","Update Playnite/extension SDK to a version where the action type is recognized.","For extension authors, return EmulationPlayAction/AutomaticPlayController/GameAction rather than custom types."],"exampleFix":"// before\nelse { throw new NotSupportedException(\"Uknown play action type.\"); }\n\n// after — log the actual type for diagnosis\nelse { throw new NotSupportedException($\"Unsupported play action type '{playAction?.GetType().FullName}' for controller '{controller?.GetType().Name}'.\"); }","handlingStrategy":"type-guard","validationCode":"// Confirm playAction is a supported type before starting.\nif (!(playAction is EmulationPlayAction || playAction is AutomaticPlayController || playAction is GameAction)) {\n    logger.Error($\"Unsupported play action: {playAction?.GetType().FullName}\");\n    return;\n}","typeGuard":"static bool IsSupportedPlayAction(object action) =>\n    action is EmulationPlayAction || action is AutomaticPlayController || action is GameAction;","tryCatchPattern":null,"preventionTips":["Extension authors should return only the three supported action types.","Keep Playnite and extension SDK versions aligned.","Log the concrete action type when dispatch fails to aid diagnosis."],"tags":["game-controller","play-action","exhaustiveness","extension"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}