JosefNemec/Playnite · critical · Exception

Only one application instance is allowed.

Error message

Only one application instance is allowed.

What it means

Thrown by the PlayniteApplication constructor when the static Current singleton is already set. Playnite enforces a single process-wide application instance; constructing a second PlayniteApplication is a programmer error rather than a runtime condition.

Source

Thrown at source/Playnite/App/PlayniteApplication.cs:99

        public PlayniteUriHandler UriHandler { get; }
        public PlayniteAPI PlayniteApiGlobal { get; set; }
        public GameControllerManager GameController { get; set; }

        private ExtensionsStatusBinder extensionsStatusBinder = new ExtensionsStatusBinder();
        public ExtensionsStatusBinder ExtensionsStatusBinder { get => extensionsStatusBinder; set => SetValue(ref extensionsStatusBinder, value); }

        public PlayniteApplication()
        {
        }

        public PlayniteApplication(
            Func<Application> appInitializer,
            ApplicationMode mode,
            CmdLineOptions cmdLine)
        {
            if (Current != null)
            {
                throw new Exception("Only one application instance is allowed.");
            }

            // TODO: remove after switch to .NET 5
            // Fixes various network issues on 2004+ Win10 if TLS 1.3 is forced via registry.
            if (Computer.IsTLS13SystemWideEnabled())
            {
                logger.Warn("System wide TLS 1.3 is enabled, forcing 1.2.");
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
            }

            CmdLine = cmdLine;
            Mode = mode;
            Current = this;

            if (!Debugger.IsAttached)
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            }

View on GitHub (pinned to 5911f4e964)

Solutions

  1. Reuse the existing PlayniteApplication.Current instance instead of constructing a new one.
  2. Ensure only one construction site runs per process; guard entry points with `if (Current != null) return Current;`.
  3. In tests, run each application instance in a separate process/AppDomain.

Example fix

// before
var app = new PlayniteApplication(init, mode, cmdLine);

// after
var app = PlayniteApplication.Current ?? new PlayniteApplication(init, mode, cmdLine);
Defensive patterns

Strategy: validation

Validate before calling

if (PlayniteApplication.Current != null)
{
    return PlayniteApplication.Current;
}
var app = new PlayniteApplication(init, mode, cmdLine);

Prevention

When it happens

Trigger: Instantiating `new PlayniteApplication(...)` more than once in the same process / AppDomain, where the first instance already populated PlayniteApplication.Current.

Common situations: Test harness or tooling that spins up the application repeatedly in one process; a misuse of the SDK host embedding logic; a second startup path triggered during crash recovery.

Related errors


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