Devolutions/UniGetUI · error · InvalidOperationException

No known source matching "{request.SourceName}" was found fo

Error message

No known source matching "{request.SourceName}" was found for manager "{manager.Name}".

What it means

Thrown by ResolveSourceForAdd when SourceName is provided but SourceUrl is empty/null, AND no entry in manager.Properties.KnownSources matches the SourceName (by Name or DisplayName, case-insensitive). This means the caller wants to add a known source by name but used a name that doesn't exist in the manager's known source list.

Source

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

    {
        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}\"."
            );
    }

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

        var configuredSource = GetConfiguredSources(manager).FirstOrDefault(source =>
            SourceMatches(source, request.SourceName, request.SourceUrl)
        );
        if (configuredSource is not null)

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Provide SourceUrl along with SourceName to create a custom source rather than relying on KnownSources lookup.
  2. Call ListSources(managerName) to see valid known source names before adding.
  3. Check the exact spelling — SourceMatches is case-insensitive but requires exact Name or DisplayName match.

Example fix

// before — unknown source name without URL
await IpcManagerSettingsApi.AddSourceAsync(new IpcSourceRequest {
    ManagerName = "scoop", SourceName = "mycustombucket"
});
// after — provide URL for custom source
await IpcManagerSettingsApi.AddSourceAsync(new IpcSourceRequest {
    ManagerName = "scoop", SourceName = "mycustombucket",
    SourceUrl = "https://github.com/user/mycustombucket"
});
Defensive patterns

Strategy: validation

Validate before calling

var knownSources = IpcManagerSettingsApi.ListSources(request.ManagerName)
    .Where(s => s.IsKnown)
    .Select(s => s.Name)
    .ToHashSet(StringComparer.OrdinalIgnoreCase);

if (string.IsNullOrWhiteSpace(request.SourceUrl) && !knownSources.Contains(request.SourceName))
    throw new ArgumentException($"Unknown source '{request.SourceName}'. Provide SourceUrl or use a known source.");

Prevention

When it happens

Trigger: Calling AddSourceAsync with a SourceName that doesn't match any known source's Name or DisplayName (via SourceMatches), and without providing a SourceUrl. SourceMatches checks Name, DisplayName, and optionally Url for equality.

Common situations: Typo in the source name (e.g., 'extas' instead of 'extras'). Manager doesn't have any predefined KnownSources (e.g., a manager that only supports user-added sources). The source name is correct but in a different casing or language variant that SourceMatches doesn't catch (it does case-insensitive, but not fuzzy).

Related errors


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