Devolutions/UniGetUI · error · InvalidOperationException

The source name is required.

Error message

The source name is required.

What it means

Thrown by ResolveSourceForAdd when request.SourceName is null, empty, or whitespace. Adding a source requires at minimum a name; the URL is optional (falls back to KnownSources lookup) but the name is mandatory.

Source

Thrown at src/UniGetUI.Interface.IpcApi/IpcManagerSettingsApi.cs:406

        {
            return null;
        }

        return PEInterface.Managers.FirstOrDefault(manager =>
            manager.Id.Equals(managerName, StringComparison.OrdinalIgnoreCase)
            || manager.Name.Equals(managerName, StringComparison.OrdinalIgnoreCase)
            || manager.DisplayName.Equals(managerName, StringComparison.OrdinalIgnoreCase)
        );
    }

    private static IManagerSource ResolveSourceForAdd(
        IPackageManager manager,
        IpcSourceRequest request
    )
    {
        if (string.IsNullOrWhiteSpace(request.SourceName))
        {
            throw new InvalidOperationException("The source name is required.");
        }

        if (!string.IsNullOrWhiteSpace(request.SourceUrl))
        {
            return new ManagerSource(
                manager,
                request.SourceName,
                new Uri(request.SourceUrl, UriKind.Absolute)
            );
        }

        return manager.Properties.KnownSources.FirstOrDefault(source =>
                SourceMatches(source, request.SourceName, null)
            )
            ?? throw new InvalidOperationException(
                $"No known source matching \"{request.SourceName}\" was found for manager \"{manager.Name}\"."
            );
    }

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Set SourceName to a non-empty value on the IpcSourceRequest before calling AddSourceAsync.
  2. If adding by URL, provide both SourceName and SourceUrl.
  3. If adding a known source, provide SourceName that matches a known source's Name or DisplayName.

Example fix

// before — URL only, no name
await IpcManagerSettingsApi.AddSourceAsync(new IpcSourceRequest {
    ManagerName = "scoop", SourceUrl = "https://extras.scoop.sh"
});
// after
await IpcManagerSettingsApi.AddSourceAsync(new IpcSourceRequest {
    ManagerName = "scoop", SourceName = "extras", SourceUrl = "https://extras.scoop.sh"
});
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrWhiteSpace(request.SourceName))
    throw new ArgumentException("Source name is required.", nameof(request.SourceName));

Prevention

When it happens

Trigger: Calling AddSourceAsync with an IpcSourceRequest where SourceName is empty/whitespace. The ManagerName must already be valid (ResolveManager is called before this check, so an invalid manager throws first).

Common situations: IPC client sends a source-add request with only a URL but no name, thinking the URL alone suffices. DTO initialization sets SourceName to empty string by default — omitting it in JSON leaves it empty.

Related errors


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