Devolutions/UniGetUI · error · InvalidOperationException
{expectedName} maintenance actions can only run against the
Error message
{expectedName} maintenance actions can only run against the {expectedName} manager. What it means
Thrown by EnsureManager when the resolved IPackageManager's Name property does not match the expected manager name (case-insensitive). This guard prevents cross-manager damage, e.g., running the Scoop uninstall script against the WinGet manager instance. The check compares manager.Name, not manager.Id or DisplayName.
Source
Thrown at src/UniGetUI.Interface.IpcApi/IpcManagerMaintenanceApi.cs:356
);
}
}
private static void EnsureConfirmed(IpcManagerMaintenanceRequest request, string action)
{
if (!request.Confirm)
{
throw new InvalidOperationException(
$"The manager action \"{action}\" requires confirm=true."
);
}
}
private static void EnsureManager(IPackageManager manager, string expectedName)
{
if (!manager.Name.Equals(expectedName, StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException(
$"{expectedName} maintenance actions can only run against the {expectedName} manager."
);
}
}
private static void EnsureWindowsOnly(string action)
{
if (!OperatingSystem.IsWindows())
{
throw new InvalidOperationException(
$"The manager action \"{action}\" is only supported on Windows."
);
}
}
private static IpcManagerMaintenanceActionResult Success(
string command,
IPackageManager manager,View on GitHub (pinned to 9b1d7d0eab)
Solutions
- Match the action to the correct manager: 'repair-winget' requires ManagerName resolving to WinGet; 'install-scoop'/'uninstall-scoop'/'cleanup-scoop' require Scoop.
- Call GetMaintenanceInfo(managerName).SupportedActions first to verify which actions are valid for that manager.
- Verify the manager's Id matches what you expect — ResolveManager matches by Id, not Name.
Example fix
// before — action and manager mismatch
await IpcManagerMaintenanceApi.RunActionAsync(new IpcManagerMaintenanceRequest {
ManagerName = "winget", Action = "install-scoop", Confirm = true
});
// after
await IpcManagerMaintenanceApi.RunActionAsync(new IpcManagerMaintenanceRequest {
ManagerName = "scoop", Action = "install-scoop", Confirm = true
}); Defensive patterns
Strategy: validation
Validate before calling
static readonly Dictionary<string, string> ActionToManager = new()
{
["repair-winget"] = "WinGet",
["install-scoop"] = "Scoop",
["uninstall-scoop"] = "Scoop",
["cleanup-scoop"] = "Scoop",
};
if (ActionToManager.TryGetValue(request.Action!, out var expected))
{
var info = IpcManagerMaintenanceApi.GetMaintenanceInfo(request.ManagerName);
if (!info.Manager.Equals(expected, StringComparison.OrdinalIgnoreCase))
throw new ArgumentException($"Action {request.Action} requires {expected}.");
} Prevention
- Match the action string to the correct manager name before calling.
- Use GetMaintenanceInfo().SupportedActions to validate action availability for a manager.
- Note that EnsureManager checks manager.Name, not manager.Id or DisplayName.
When it happens
Trigger: Calling RunActionAsync with a manager name that resolves to a different manager than the action expects. For example, passing ManagerName that ResolveManager maps to the WinGet manager but Action is 'install-scoop' (which calls EnsureManager(manager, "Scoop")).
Common situations: Manager name alias collision — the caller passes a manager name that ResolveManager matches to a different manager. Copy-paste error where the action string and manager name don't align. The manager resolution uses only Id for exact matching (MatchesManagerId checks Id only), so a mismatched ID silently resolves to the wrong manager.
Related errors
- The manager action "{action}" requires confirm=true.
- The manager action "{action}" is only supported on Windows.
- No package managers are available.
- No package manager matching "{managerName}" was found.
- The manager parameter is required.
AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13).
Data as JSON: /api/errors/e456e927ed2236d3.
Report an issue: GitHub.