JosefNemec/Playnite · error · Exception

playnite:// uri missing parameters.

Error message

playnite:// uri missing parameters.

What it means

Thrown by PlayniteUriHandler.ParseUri when splitting a playnite:// URI yields fewer than 2 non-empty segments — i.e. the URI has no command after the scheme. A valid playnite URI must contain at least a source (e.g. playnite://source/...), so fewer segments means the URI is malformed.

Source

Thrown at source/Playnite/PlayniteUriHandler.cs:65

            Handlers.Add(source, handler);
        }

        public void RemoveSource(string source)
        {
            var handler = Handlers.FirstOrDefault(a => a.Key.Equals(source, StringComparison.OrdinalIgnoreCase));
            if (handler.Value != null)
            {
                Handlers.Remove(handler.Key);
            }
        }

        public static (string source, string[] arguments) ParseUri(string uri)
        {
            var split = uri.Split(uriSplitter, StringSplitOptions.RemoveEmptyEntries);
            if (split.Length < 2)
            {
                throw new Exception("playnite:// uri missing parameters.");
            }

            var source = split[1];
            var arguments = new string[0];
            if (split.Length > 2)
            {
                arguments = split.Skip(2).Select(a => HttpUtility.UrlDecode(a)).ToArray();
            }

            return (source, arguments);
        }

        internal void ProcessUri(string uri)
        {
            logger.Info($"Processing Playnite URI {uri}");
            try
            {
                var (source, arguments) = ParseUri(uri);

View on GitHub (pinned to 5911f4e964)

Solutions

  1. Validate the URI format (contains at least a source segment) before calling ParseUri.
  2. Construct playnite URIs using a helper that always appends the source and arguments.
  3. Catch the exception at the URI entry point and log/ignore malformed invocations.

Example fix

// before
var split = uri.Split(uriSplitter, StringSplitOptions.RemoveEmptyEntries);
if (split.Length < 2) { throw new Exception("playnite:// uri missing parameters."); }

// after
var split = uri.Split(uriSplitter, StringSplitOptions.RemoveEmptyEntries);
if (split.Length < 2) {
    logger.Warn($"Malformed playnite URI ignored: {uri}");
    return (null, Array.Empty<string>());
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate URI shape before parsing.
var segs = uri.Split(new[]{"playnite://"}, StringSplitOptions.RemoveEmptyEntries);
if (segs.Length == 0 || !segs[0].Contains("/")) { logger.Warn($"Malformed playnite URI: {uri}"); return; }

Type guard

static bool IsValidPlayniteUri(string uri) =>
    !uri.IsNullOrEmpty() && uri.Split(uriSplitter, StringSplitOptions.RemoveEmptyEntries).Length >= 2;

Try / catch

try { var (source, args) = PlayniteUriHandler.ParseUri(uri); }
catch (Exception ex) when (ex.Message.Contains("missing parameters")) { logger.Warn($"Ignored malformed URI: {uri}"); }

Prevention

When it happens

Trigger: ParseUri receives a string like 'playnite://' or 'playnite://playnite' that, after splitting on uriSplitter and removing empties, leaves 0 or 1 segment. Happens with truncated, hand-typed, or malformed invocations.

Common situations: External application or shortcut launches a bare playnite:// URI without arguments; URI was constructed/encoded incorrectly; an addon registered a handler but the caller sent an empty command.

Related errors


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