Devolutions/UniGetUI · error · InvalidOperationException
The status parameter must be either keep or delete.
Error message
The status parameter must be either keep or delete.
What it means
Thrown by IpcDesktopShortcutsApi.SetShortcut when request.Status (trimmed, lowercased) is neither 'keep' nor 'delete'. These are the only two statuses the set-shortcut operation accepts because they map directly to DesktopShortcutsDatabase.Status.Maintain and .Delete.
Source
Thrown at src/UniGetUI.Interface.IpcApi/IpcDesktopShortcutsApi.cs:58
return allShortcuts
.OrderBy(path => System.IO.Path.GetFileName(path), StringComparer.OrdinalIgnoreCase)
.ThenBy(path => path, StringComparer.OrdinalIgnoreCase)
.Select(path => ToShortcutInfo(path, trackedShortcuts))
.ToArray();
}
public static IpcDesktopShortcutOperationResult SetShortcut(
IpcDesktopShortcutRequest request
)
{
string shortcutPath = NormalizeShortcutPath(request.Path);
string shortcutStatus = request.Status?.Trim().ToLowerInvariant() ?? "";
DesktopShortcutsDatabase.Status status = shortcutStatus switch
{
"delete" => DesktopShortcutsDatabase.Status.Delete,
"keep" => DesktopShortcutsDatabase.Status.Maintain,
_ => throw new InvalidOperationException(
"The status parameter must be either keep or delete."
),
};
DesktopShortcutsDatabase.AddToDatabase(shortcutPath, status);
DesktopShortcutsDatabase.RemoveFromUnknownShortcuts(shortcutPath);
if (status is DesktopShortcutsDatabase.Status.Delete && File.Exists(shortcutPath))
{
DesktopShortcutsDatabase.DeleteFromDisk(shortcutPath);
}
return new IpcDesktopShortcutOperationResult
{
Command = "set-desktop-shortcut",
Shortcut = ToShortcutInfo(shortcutPath),
};
}View on GitHub (pinned to 9b1d7d0eab)
Solutions
- Send Status 'keep' to maintain the shortcut or 'delete' to remove it.
- Do not reuse a status value read from the info endpoint (e.g. 'unknown') directly in a set request.
- Use the reset-shortcut endpoint if you want to return a shortcut to unknown/pending-review.
Example fix
// before
{ "path": "...", "status": "maintain" }
// after
{ "path": "...", "status": "keep" } Defensive patterns
Strategy: validation
Validate before calling
static bool IsValidShortcutStatus(string? s) =>
s?.Trim().ToLowerInvariant() is "keep" or "delete"; Prevention
- Use a fixed keep/delete selector in the UI, not free text.
- Never echo an info-endpoint status ('unknown') into a set request.
When it happens
Trigger: POSTing to the set-desktop-shortcut endpoint with a Status of 'unknown', 'remove', 'always', 'maintain' (the code wants 'keep'), or null. The switch has no default-accept; anything off-list throws.
Common situations: Using 'maintain' (the internal enum name) instead of the API token 'keep'. Sending 'unknown' (which the info endpoint can return) back as a set action. Passing an empty or null Status expecting a default.
Related errors
- The bundle selection mode "{selection}" is not supported.
- The path parameter is required.
- The manager action "{request.Action}" is not supported.
- Bundle export only supports .ubundle and .json output files.
- The bundle format "{format}" is not supported.
AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13).
Data as JSON: /api/errors/71bf2770ced19a11.
Report an issue: GitHub.