{"record":{"id":"54136efa5fe5f11a","repo":"Devolutions/UniGetUI","slug":"the-manager-action-action-requires-confirm-tru","errorCode":null,"errorMessage":"The manager action \"{action}\" requires confirm=true.","messagePattern":"The manager action \"(.+?)\" requires confirm=true\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/UniGetUI.Interface.IpcApi/IpcManagerMaintenanceApi.cs","lineNumber":346,"sourceCode":"                Verb = runAsAdmin ? \"runas\" : string.Empty,\n                CreateNoWindow = !runAsAdmin,\n            },\n        };\n        process.Start();\n        await process.WaitForExitAsync();\n        if (process.ExitCode != 0)\n        {\n            throw new InvalidOperationException(\n                $\"The maintenance command exited with code {process.ExitCode}.\"\n            );\n        }\n    }\n\n    private static void EnsureConfirmed(IpcManagerMaintenanceRequest request, string action)\n    {\n        if (!request.Confirm)\n        {\n            throw new InvalidOperationException(\n                $\"The manager action \\\"{action}\\\" requires confirm=true.\"\n            );\n        }\n    }\n\n    private static void EnsureManager(IPackageManager manager, string expectedName)\n    {\n        if (!manager.Name.Equals(expectedName, StringComparison.OrdinalIgnoreCase))\n        {\n            throw new InvalidOperationException(\n                $\"{expectedName} maintenance actions can only run against the {expectedName} manager.\"\n            );\n        }\n    }\n\n    private static void EnsureWindowsOnly(string action)\n    {\n        if (!OperatingSystem.IsWindows())","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcManagerMaintenanceApi.cs#L328-L364","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set Confirm=true on the request object before calling RunActionAsync for any of the four destructive actions.","Check GetMaintenanceInfo().SupportedActions to see which actions require confirmation before calling.","For the 'reload' action, no Confirm is needed — it does not call EnsureConfirmed."],"exampleFix":"// before\nvar req = new IpcManagerMaintenanceRequest {\n    ManagerName = \"Scoop\",\n    Action = \"install-scoop\"\n};\n// after\nvar req = new IpcManagerMaintenanceRequest {\n    ManagerName = \"Scoop\",\n    Action = \"install-scoop\",\n    Confirm = true\n};","handlingStrategy":"validation","validationCode":"static bool RequiresConfirmation(string action) =>\n    action is \"repair-winget\" or \"install-scoop\" or \"uninstall-scoop\" or \"cleanup-scoop\";\n\n// Before calling:\nif (RequiresConfirmation(request.Action!) && !request.Confirm)\n    throw new ArgumentException(\"Set Confirm=true for destructive actions.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set Confirm=true explicitly for destructive maintenance actions.","Create a factory method that defaults Confirm based on the action type.","Remember that bool defaults to false — omitting Confirm is the same as Confirm=false."],"tags":["maintenance","ipc","validation","confirmation"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}