{"record":{"id":"59d34f71957f8616","repo":"JosefNemec/Playnite","slug":"cannot-start-emulator-using-this-configuration","errorCode":null,"errorMessage":"Cannot start emulator using this configuration.","messagePattern":"Cannot start emulator using this configuration\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/Playnite/Controllers/GenericGameController.cs","lineNumber":490,"sourceCode":"            };\r\n\r\n            Start(action, true, new OnGameStartingEventArgs\r\n            {\r\n                SourceAction = action,\r\n                Game = Game\r\n            });\r\n        }\r\n\r\n        public void Start(GameAction playAction, bool asyncExec, OnGameStartingEventArgs startingArgs)\r\n        {\r\n            if (playAction == null)\r\n            {\r\n                throw new ArgumentNullException(\"Cannot start game without play action.\");\r\n            }\r\n\r\n            if (playAction.Type == GameActionType.Emulator)\r\n            {\r\n                throw new Exception(\"Cannot start emulator using this configuration.\");\r\n            }\r\n\r\n            StartingArgs = startingArgs;\r\n            var gameClone = Game.GetClone();\r\n            var action = playAction.GetClone();\r\n            action = action.ExpandVariables(gameClone);\r\n            action.Path = CheckPath(action.Path, nameof(action.Path), FileSystemItem.File);\r\n            action.WorkingDir = CheckPath(action.WorkingDir, nameof(action.WorkingDir), FileSystemItem.Directory);\r\n\r\n            if (playAction.Type == GameActionType.Script)\r\n            {\r\n                if (action.Script.IsNullOrWhiteSpace())\r\n                {\r\n                    throw new ArgumentNullException(\"Game script is not defined.\");\r\n                }\r\n\r\n                action.Script = Game.ExpandVariables(action.Script, false);\r\n                RunStartScript(\r","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Controllers/GenericGameController.cs#L472-L508","documentation":"Thrown as a generic Exception when Start(GameAction, bool, OnGameStartingEventArgs) receives a GameAction whose Type is GameActionType.Emulator. This overload explicitly does NOT handle emulator-type actions; emulator games must be started through the dedicated emulator start path (Start with an emulator-specific game action configuration). Passing an emulator action here is a misuse of the API.","triggerScenarios":"A game's play action has Type=GameActionType.Emulator but the caller invoked the non-emulator Start overload instead of the emulator-specific Start path. This can happen when a plugin routes all game starts through a single code path without checking action type.","commonSituations":"A custom extension or script calls GenericGameController.Start without first dispatching emulator-type actions to the emulator code path. A game was configured as an emulator game but the launch routing logic is broken. A refactoring merged two Start overloads incorrectly.","solutions":["Route emulator-type actions to the emulator start path: check action.Type == GameActionType.Emulator and call the emulator-specific StartEmulator method instead.","If building a plugin, use PlayniteApi.StartGame or the appropriate GameController method that handles all action types.","Audit the game's action configuration: if it should be a non-emulator game, change the action type to File, URL, or Script.","Review the calling code to ensure it dispatches by action type before calling Start."],"exampleFix":"// before — all actions funneled through the non-emulator Start\nvar action = game.PlayAction;\ncontroller.Start(action, true, startingArgs); // throws if Type == Emulator\n\n// after — dispatch by action type\nif (action.Type == GameActionType.Emulator)\n{\n    controller.StartEmulator(action, emuProfile, romPath, true);\n}\nelse\n{\n    controller.Start(action, true, startingArgs);\n}","handlingStrategy":"validation","validationCode":"if (action?.Type == GameActionType.Emulator)\n{\n    logger.Error(\"Use the emulator-specific Start method for emulator actions.\");\n    throw new InvalidOperationException(\"Emulator actions must use StartEmulator, not Start.\");\n}","typeGuard":"static bool RequiresEmulatorStartPath(GameAction action)\n{\n    return action != null && action.Type == GameActionType.Emulator;\n}","tryCatchPattern":null,"preventionTips":["Dispatch by action type before calling any Start overload.","Document the Start method as non-emulator-only in SDK and extension docs.","Add unit tests verifying emulator actions are rejected by the non-emulator Start."],"tags":["emulator","play-action","api-misuse","game-start","action-type"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}