Devolutions/UniGetUI · error · InvalidOperationException

The bundle format "{format}" is not supported.

Error message

The bundle format "{format}" is not supported.

What it means

Thrown by IpcBundleApi.ParseFormat when an explicit format string (after trimming a leading dot and lowercasing) is not one of ubundle/json/yaml/yml/xml. ParseFormat is used for import format resolution, both from an explicit --format flag and from a file extension when no format is given.

Source

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

        return extension.ToLowerInvariant() switch
        {
            ".json" => BundleFormatType.JSON,
            ".ubundle" or "" => BundleFormatType.UBUNDLE,
            _ => throw new InvalidOperationException(
                "Bundle export only supports .ubundle and .json output files."
            ),
        };
    }

    private static BundleFormatType ParseFormat(string? format)
    {
        return format?.Trim().TrimStart('.').ToLowerInvariant() switch
        {
            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."
            ),
        };
    }

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Use one of the supported format tokens: ubundle, json, yaml, yml, or xml.
  2. If importing by path, rely on the file extension instead of passing --format, or rename the file to a recognized extension.
  3. Strip stray characters from the format value before sending (ParseFormat only trims one leading dot).

Example fix

// before
unigetui bundle import --format toml --path set.txt
// after
unigetui bundle import --format json --path set.txt
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<string> s_formats = new(StringComparer.OrdinalIgnoreCase)
    { "ubundle", "json", "yaml", "yml", "xml" };

static bool IsValidFormat(string? f) =>
    string.IsNullOrWhiteSpace(f) || s_formats.Contains(f.Trim().TrimStart('.'));

Prevention

When it happens

Trigger: Calling bundle import with '--format toml', '--format csv', or a malformed value like '--format .ubundle2'. Also triggered when the import path's extension resolves to an unknown value AND no explicit Format is supplied on the request object (ResolveImportFormat falls back to ParseFormat(extension)).

Common situations: Typing a format name from memory (e.g. 'yml' works but 'yaml-file' does not). Passing a path with a non-bundle extension (e.g. .txt) and no --format override. Case is handled (lowercased) but leading-only-dot is stripped, so '..json' fails.

Related errors


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