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
- Reuse the existing PlayniteApplication.Current instance instead of constructing a new one.
- Ensure only one construction site runs per process; guard entry points with `if (Current != null) return Current;`.
- 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
- Treat PlayniteApplication as a per-process singleton; reuse Current.
- Run each instance in its own process/AppDomain in tests.
- Guard all construction sites against an already-set Current.
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
- Another Playnite instance didn't shutdown in time.
- LOC.ErrorPowerShellNotInstalled
- Cannot add file to database, file not found.
- Not supported in Desktop mode.
- Cannot open plugin settings in Fullscreen mode.
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/a8e2d7b62af717fb.
Report an issue: GitHub.