Devolutions/UniGetUI · error · InvalidOperationException
The action field is required.
Error message
The action field is required.
What it means
Thrown by IpcManagerMaintenanceApi.RunActionAsync when request.Action is null (the ?? coalesce fires). Note this only triggers on a truly null Action; a non-null but unrecognized action falls through to the default arm (error 39). The Action field selects which maintenance procedure to run.
Source
Thrown at src/UniGetUI.Interface.IpcApi/IpcManagerMaintenanceApi.cs:119
Settings.RemoveDictionaryKey<string, string>(Settings.K.ManagerPaths, manager.Name);
await ReloadManagerAsync(manager);
return Success(
"clear-manager-executable",
manager,
"clear-executable",
"completed",
$"Cleared the custom executable override for {manager.DisplayName}."
);
}
public static async Task<IpcManagerMaintenanceActionResult> RunActionAsync(
IpcManagerMaintenanceRequest request
)
{
ArgumentNullException.ThrowIfNull(request);
var manager = IpcManagerSettingsApi.ResolveManager(request.ManagerName);
string action = request.Action?.Trim().ToLowerInvariant()
?? throw new InvalidOperationException("The action field is required.");
switch (action)
{
case "repair-winget":
EnsureConfirmed(request, action);
EnsureManager(manager, "WinGet");
EnsureWindowsOnly(action);
await RunWindowsProcessAsync(
CoreData.PowerShell5,
"-ExecutionPolicy Bypass -NoLogo -NoProfile -Command \"& {"
+ "cmd.exe /C \"\"rmdir /Q /S `\"%temp%\\WinGet`\"\"\"; "
+ "cmd.exe /C \"\"`\"%localappdata%\\Microsoft\\WindowsApps\\winget.exe`\" source reset --force\"\"; "
+ "taskkill /im winget.exe /f; "
+ "taskkill /im WindowsPackageManagerServer.exe /f; "
+ "Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force; "
+ "Install-Module Microsoft.WinGet.Client -Force -AllowClobber; "
+ "Import-Module Microsoft.WinGet.Client; "
+ "Repair-WinGetPackageManager -Force -Latest; "View on GitHub (pinned to 9b1d7d0eab)
Solutions
- Include an Action field with one of the supported maintenance actions (e.g. repair-winget, install-scoop, uninstall-scoop, cleanup-scoop).
- If the body is being built dynamically, default Action to a concrete value rather than leaving it null.
- Consult ToMaintenanceInfo/GetMaintenanceInfo for the supportedActions list for the target manager.
Example fix
// before
{ "managerName": "winget", "action": null }
// after
{ "managerName": "winget", "action": "repair-winget", "confirm": true } Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(request.Action)) { /* require the user to choose an action */ } Prevention
- Bind the action field to a non-null enum/selector in the client DTO.
- Read supportedActions from GetMaintenanceInfo to populate the selector.
When it happens
Trigger: POSTing to the manager maintenance action endpoint with the Action field omitted or explicitly null. An empty/whitespace Action is trimmed to empty string, which is non-null, so it reaches the switch and falls to error 39 instead.
Common situations: A client library that omits nullable fields rather than sending them. A malformed JSON body missing the action key. A UI binding that did not set the selected action.
Related errors
- The path field is required.
- This command requires {argumentName} with a value of true or
- The path parameter is required.
- The manager action "{request.Action}" is not supported.
- Bundle export only supports .ubundle and .json output files.
AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13).
Data as JSON: /api/errors/9867d650bf1c1c07.
Report an issue: GitHub.