Devolutions/UniGetUI · warning · InvalidOperationException
The backup key is required.
Error message
The backup key is required.
What it means
ValidateBackupKey is called by DownloadCloudBackupAsync and RestoreCloudBackupAsync on request.Key before doing any work. If the key is null, empty, or whitespace, it throws InvalidOperationException. The key identifies a specific machine/device backup within the gist, so a blank value is a client error.
Source
Thrown at src/UniGetUI.Interface.IpcApi/IpcBackupApi.cs:561
isPublic: false,
new Dictionary<string, string> { ["- UniGetUI Package Backups"] = ReadMeContents }
);
}
private static string BuildGistFileKey()
{
string deviceUser = (Environment.MachineName + "\\" + Environment.UserName).Replace(
" ",
string.Empty
);
return PackageBackupStartingKey + " " + deviceUser;
}
private static string ValidateBackupKey(string key)
{
if (string.IsNullOrWhiteSpace(key))
{
throw new InvalidOperationException("The backup key is required.");
}
return key;
}
private static PendingGitHubDeviceFlow GetPendingGitHubDeviceFlow()
{
lock (GitHubAuthLock)
{
return _pendingGitHubDeviceFlow
?? throw new InvalidOperationException(
"No GitHub device flow is pending. Start sign-in first."
);
}
}
private static void ClearPendingGitHubDeviceFlow()
{View on GitHub (pinned to 9b1d7d0eab)
Solutions
- Provide a non-empty Key in the IpcCloudBackupRequest, obtained from ListCloudBackupsAsync.
- Validate the key client-side before sending the request.
- Default to the current machine's key (BuildGistFileKey / CurrentMachineBackupKey from GetStatusAsync) if the user did not pick one.
Example fix
// before: empty key
await IpcBackupApi.DownloadCloudBackupAsync(new IpcCloudBackupRequest { Key = "" });
// after: use the current machine key or a listed entry
var status = await IpcBackupApi.GetStatusAsync();
await IpcBackupApi.DownloadCloudBackupAsync(new IpcCloudBackupRequest { Key = status.CurrentMachineBackupKey }); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrWhiteSpace(request.Key))
{
var status = await IpcBackupApi.GetStatusAsync();
request.Key = status.CurrentMachineBackupKey;
} Type guard
static bool HasBackupKey(string? key) => !string.IsNullOrWhiteSpace(key);
Try / catch
try { await IpcBackupApi.DownloadCloudBackupAsync(request); }
catch (InvalidOperationException ex) when (ex.Message.Contains("backup key is required"))
{ /* client must supply a key */ } Prevention
- Always populate Key, defaulting to CurrentMachineBackupKey from GetStatusAsync.
- Validate the key client-side before sending the IPC request.
- Never submit an empty/null key.
When it happens
Trigger: An IPC client sends a DownloadCloudBackupAsync or RestoreCloudBackupAsync request with Key unset (null), empty string, or whitespace. This is purely a client-side validation failure before any GitHub API call.
Common situations: The client omitted the Key field in the request JSON. The key was read from a config that had no value. A UI form submitted without selecting a backup entry. A programmatic caller forgot to populate the key.
Related errors
- The cloud backup \"{key}\" was not found.
- Exactly one of content or path must be supplied when importi
- Unsupported page \"{page}\". Supported pages: {string.Join("
- The GitHub backup gist could not be created.
- GitHub authentication is required for cloud backups.
AI-assisted analysis of Devolutions/UniGetUI@9b1d7d0eab (2026-08-13).
Data as JSON: /api/errors/bd3202b28db94b31.
Report an issue: GitHub.