Devolutions/UniGetUI · error · InvalidOperationException

The manager action "{action}" requires confirm=true.

Error message

The manager action "{action}" requires confirm=true.

What it means

Thrown by EnsureConfirmed when request.Confirm is false (the default for bool). The four destructive maintenance actions — repair-winget, install-scoop, uninstall-scoop, and cleanup-scoop — all call EnsureConfirmed as their first guard to require an explicit opt-in. This is a safety interlock to prevent accidental system-level changes.

Source

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

                Verb = runAsAdmin ? "runas" : string.Empty,
                CreateNoWindow = !runAsAdmin,
            },
        };
        process.Start();
        await process.WaitForExitAsync();
        if (process.ExitCode != 0)
        {
            throw new InvalidOperationException(
                $"The maintenance command exited with code {process.ExitCode}."
            );
        }
    }

    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())

View on GitHub (pinned to 9b1d7d0eab)

Solutions

  1. Set Confirm=true on the request object before calling RunActionAsync for any of the four destructive actions.
  2. Check GetMaintenanceInfo().SupportedActions to see which actions require confirmation before calling.
  3. For the 'reload' action, no Confirm is needed — it does not call EnsureConfirmed.

Example fix

// before
var req = new IpcManagerMaintenanceRequest {
    ManagerName = "Scoop",
    Action = "install-scoop"
};
// after
var req = new IpcManagerMaintenanceRequest {
    ManagerName = "Scoop",
    Action = "install-scoop",
    Confirm = true
};
Defensive patterns

Strategy: validation

Validate before calling

static bool RequiresConfirmation(string action) =>
    action is "repair-winget" or "install-scoop" or "uninstall-scoop" or "cleanup-scoop";

// Before calling:
if (RequiresConfirmation(request.Action!) && !request.Confirm)
    throw new ArgumentException("Set Confirm=true for destructive actions.");

Prevention

When it happens

Trigger: Calling RunActionAsync with action set to 'repair-winget', 'install-scoop', 'uninstall-scoop', or 'cleanup-scoop' but omitting Confirm=true (or explicitly setting Confirm=false) on the IpcManagerMaintenanceRequest.

Common situations: Developer forgets that the IpcManagerMaintenanceRequest DTO initializes Confirm to false. An IPC client serializes the request and omits the confirm field, which deserializes to false. Integration test harnesses that construct the DTO without setting Confirm.

Related errors


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