Devolutions/UniGetUI · error · InvalidOperationException

The bundle selection mode "{selection}" is not supported.

Error message

The bundle selection mode "{selection}" is not supported.

What it means

Thrown by IpcBundleApi.ParseLookupMode when the package selection/lookup mode string is not one of search/installed/updates/upgradable/auto (or empty, which defaults to Search). This mode controls how a bundle-add package request resolves an ambiguous package id across installed, upgradable, and search result sets.

Source

Thrown at src/UniGetUI.Interface.IpcApi/IpcBundleApi.cs:551

            null or "" or "ubundle" => BundleFormatType.UBUNDLE,
            "json" => BundleFormatType.JSON,
            "yaml" or "yml" => BundleFormatType.YAML,
            "xml" => BundleFormatType.XML,
            _ => throw new InvalidOperationException(
                $"The bundle format \"{format}\" is not supported."
            ),
        };
    }

    private static IpcPackageLookupMode ParseLookupMode(string? selection)
    {
        return selection?.Trim().ToLowerInvariant() switch
        {
            null or "" or "search" => IpcPackageLookupMode.Search,
            "installed" => IpcPackageLookupMode.Installed,
            "updates" or "upgradable" => IpcPackageLookupMode.Upgradable,
            "auto" => IpcPackageLookupMode.Any,
            _ => throw new InvalidOperationException(
                $"The bundle selection mode \"{selection}\" is not supported."
            ),
        };
    }

    internal static async Task<string> CreateBundleAsync(IReadOnlyList<IPackage> unsortedPackages)
    {
        var exportableData = new SerializableBundle();
        var packages = unsortedPackages.ToList();
        packages.Sort((x, y) =>
        {
            if (x.Id != y.Id)
            {
                return string.Compare(x.Id, y.Id, StringComparison.Ordinal);
            }

            if (x.Name != y.Name)
            {

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Use one of: search (default), installed, updates, upgradable, or auto.
  2. Omit --selection entirely to accept the Search default.
  3. Check the CLI help text for the bundle add command for the current token list before scripting.

Example fix

// before
unigetui bundle add --package-id git --manager winget --selection any
// after
unigetui bundle add --package-id git --manager winget --selection auto
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<string> s_modes = new(StringComparer.OrdinalIgnoreCase)
    { "search", "installed", "updates", "upgradable", "auto" };

static bool IsValidSelection(string? s) =>
    string.IsNullOrWhiteSpace(s) || s_modes.Contains(s.Trim().ToLowerInvariant());

Prevention

When it happens

Trigger: Calling the bundle package-add endpoint (CLI 'bundle add') with '--selection all', '--selection everything', or any token outside the allowed set. The Selection field on IpcBundlePackageRequest is forwarded verbatim into ParseLookupMode.

Common situations: A user guessing the flag value ('--selection any' instead of '--selection auto'). Mixing up this selector with another API's vocabulary. Passing 'upgrade' (singular) instead of 'updates'.

Related errors


AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13). Data as JSON: /api/errors/f776e2be17cf22a4. Report an issue: GitHub.