JosefNemec/Playnite · error · ArgumentNullException

Cannot start game without play action.

Error message

Cannot start game without play action.

What it means

Thrown as ArgumentNullException when the Start(GameAction playAction, ...) method receives a null playAction. This is a programming-contract violation: the caller must supply a valid GameAction before invoking start. The Start method at this signature is the non-emulator entry point and playAction is its mandatory input.

Source

Thrown at source/Playnite/Controllers/GenericGameController.cs:485

                WorkingDir = controller.WorkingDir,
                TrackingMode = controller.TrackingMode,
                TrackingPath = controller.TrackingPath,
                InitialTrackingDelay = controller.InitialTrackingDelay,
                TrackingFrequency = controller.TrackingFrequency
            };

            Start(action, true, new OnGameStartingEventArgs
            {
                SourceAction = action,
                Game = Game
            });
        }

        public void Start(GameAction playAction, bool asyncExec, OnGameStartingEventArgs startingArgs)
        {
            if (playAction == null)
            {
                throw new ArgumentNullException("Cannot start game without play action.");
            }

            if (playAction.Type == GameActionType.Emulator)
            {
                throw new Exception("Cannot start emulator using this configuration.");
            }

            StartingArgs = startingArgs;
            var gameClone = Game.GetClone();
            var action = playAction.GetClone();
            action = action.ExpandVariables(gameClone);
            action.Path = CheckPath(action.Path, nameof(action.Path), FileSystemItem.File);
            action.WorkingDir = CheckPath(action.WorkingDir, nameof(action.WorkingDir), FileSystemItem.Directory);

            if (playAction.Type == GameActionType.Script)
            {
                if (action.Script.IsNullOrWhiteSpace())
                {

View on GitHub (pinned to 5911f4e964)

Solutions

  1. Assign a play action to the game: open the game's edit dialog and configure a valid play action (File, URL, or Script).
  2. If calling Start programmatically, always null-check the action before invoking: if (game.GameActions?.Any() != true) return;
  3. Verify the game's Actions collection is populated after metadata imports or migrations.
  4. Set a default action via the game editor's 'Play' tab before launching.

Example fix

// before — launching a game whose play action is null
controller.Start(game.PlayAction, true, startingArgs);

// after — guard before calling Start
var action = game.PlayAction ?? game.GameActions?.FirstOrDefault(a => a.IsPlayAction);
if (action == null)
{
    logger.Warn($"Game '{game.Name}' has no play action.");
    return;
}
controller.Start(action, true, startingArgs);
Defensive patterns

Strategy: validation

Validate before calling

if (game.PlayAction == null && (game.GameActions?.Any(a => a.IsPlayAction) != true))
{
    logger.Warn($"Game '{game.Name}' has no play action.");
    return;
}

Type guard

static bool HasValidPlayAction(Game game)
{
    return game.PlayAction != null ||
           (game.GameActions?.Any(a => a.IsPlayAction) == true);
}

Try / catch

try
{
    controller.Start(action, true, startingArgs);
}
catch (ArgumentNullException ex) when (ex.Message.Contains("play action"))
{
    logger.Error($"Attempted to start game without a play action: {game.Name}");
    Dialogs.ShowMessage("This game has no play action configured.");
}

Prevention

When it happens

Trigger: Game.GameActions is empty or the play action was never assigned, so the controller calls Start(null, ...). A plugin or script programmatically invokes PlayniteController.Start with a null action. A game's default play action was deleted but the game was still launched.

Common situations: The game has no actions defined and no default play action set. A metadata import cleared the Actions collection. A user script or extension calls the start API incorrectly. The game object is in a partially-initialized state after a database migration.

Related errors


AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13). Data as JSON: /api/errors/5a5b2cc0abd8275b. Report an issue: GitHub.