Devolutions/UniGetUI · error · InvalidOperationException

The bundle content could not be parsed.

Error message

The bundle content could not be parsed.

What it means

Thrown by IpcBundleApi.AddFromBundleAsync when JsonNode.Parse(content) returns null, i.e. the bundle payload (after optional YAML/XML-to-JSON conversion) is not valid parseable JSON. This is the import deserialization failure point; everything before it (format detection, file read, format conversion) succeeded.

Source

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

    internal static async Task<(double SchemaVersion, BundleReport Report)> AddFromBundleAsync(
        string content,
        BundleFormatType format
    )
    {
        if (format == BundleFormatType.YAML)
        {
            content = await SerializationHelpers.YAML_to_JSON(content);
        }
        else if (format == BundleFormatType.XML)
        {
            content = await SerializationHelpers.XML_to_JSON(content);
        }

        var deserializedData = await Task.Run(() =>
            new SerializableBundle(
                JsonNode.Parse(content)
                    ?? throw new InvalidOperationException("The bundle content could not be parsed.")
            )
        );

        var report = new BundleReport { IsEmpty = true };
        bool allowCliArguments =
            SecureSettings.Get(SecureSettings.K.AllowCLIArguments)
            && SecureSettings.Get(SecureSettings.K.AllowImportingCLIArguments);
        bool allowPrePostCommands =
            SecureSettings.Get(SecureSettings.K.AllowPrePostOpCommand)
            && SecureSettings.Get(SecureSettings.K.AllowImportPrePostOpCommands);

        List<IPackage> packages = [];
        foreach (var package in deserializedData.packages)
        {
            var options = package.InstallationOptions;
            ReportList(
                ref report,
                package.Id,

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Open the bundle file and validate it parses as JSON (e.g. 'python -m json.tool file.ubundle'); fix or regenerate it.
  2. If the source was YAML/XML, check the converted intermediate JSON for emptiness before importing.
  3. Re-export a fresh bundle from a running UniGetUI instance and replace the corrupt file.
  4. Confirm the file was not zeroed out by a failed save (check file size > 0).
Defensive patterns

Strategy: validation

Validate before calling

// Validate the bundle payload parses as JSON before importing.
static async Task<bool> BundleParsesAsync(string path)
{
    var content = await File.ReadAllTextAsync(path);
    if (string.IsNullOrWhiteSpace(content)) return false;
    try { return JsonNode.Parse(content) is not null; }
    catch { return false; }
}

Try / catch

try { await client.ImportBundleAsync(path, format); }
catch (InvalidOperationException ex) when (ex.Message.Contains("could not be parsed"))
{ /* treat as corrupt source file: regenerate or notify user */ }

Prevention

When it happens

Trigger: Importing a bundle file whose content is empty, whitespace-only, a JSON literal 'null', or structurally broken after YAML/XML conversion (e.g. a YAML-to-JSON conversion that produced an empty string). Also when request.Content is set to an invalid inline payload.

Common situations: A truncated/corrupt .ubundle backup (interrupted write, disk full). Hand-editing a JSON bundle and leaving a dangling comma. A YAML bundle whose converter emitted nothing. An empty file passed as the import source.

Related errors


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