Devolutions/UniGetUI · error · InvalidOperationException

The manager action "{action}" is only supported on Windows.

Error message

The manager action "{action}" is only supported on Windows.

What it means

Thrown by EnsureWindowsOnly when OperatingSystem.IsWindows() returns false. All four destructive maintenance actions (repair-winget, install-scoop, uninstall-scoop, cleanup-scoop) call EnsureWindowsOnly because they shell out to PowerShell 5 (cmd.exe-based scripts, AppxPackage cmdlets, UAC elevation) that only exist on Windows.

Source

Thrown at src/UniGetUI.Interface.IpcApi/IpcManagerMaintenanceApi.cs:366

            );
        }
    }

    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,
        string action,
        string operationStatus,
        string? message = null
    )
    {
        return new IpcManagerMaintenanceActionResult
        {
            Status = "success",
            Command = command,
            Manager = IpcManagerSettingsApi.GetPublicManagerId(manager),

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Only call Windows-only actions on Windows — gate with OperatingSystem.IsWindows() in the caller.
  2. Use GetMaintenanceInfo().SupportedActions to check available actions before calling; the list is only populated with Windows-only actions if on Windows (though note the current code adds them unconditionally in ToMaintenanceInfo).
  3. For non-Windows platforms, only use the 'reload' action which has no platform guard.

Example fix

// before — unguarded cross-platform call
await IpcManagerMaintenanceApi.RunActionAsync(req);
// after
if (!OperatingSystem.IsWindows())
    throw new PlatformNotSupportedException("Scoop actions require Windows.");
await IpcManagerMaintenanceApi.RunActionAsync(req);
Defensive patterns

Strategy: validation

Validate before calling

static readonly HashSet<string> WindowsOnlyActions = new()
{
    "repair-winget", "install-scoop", "uninstall-scoop", "cleanup-scoop"
};

if (WindowsOnlyActions.Contains(request.Action!) && !OperatingSystem.IsWindows())
    throw new PlatformNotSupportedException($"{request.Action} requires Windows.");

Prevention

When it happens

Trigger: Running UniGetUI on Linux, macOS, or WSL and calling RunActionAsync with any of the four Windows-only actions. The 'reload' action does not call EnsureWindowsOnly and works cross-platform.

Common situations: Cross-platform Avalonia build running on Linux for development/testing. CI pipeline running on a Linux runner that exercises IPC endpoints. The action switch case fires before the guard, but EnsureWindowsOnly is called inside each case (after EnsureConfirmed and EnsureManager).

Related errors


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