{"record":{"id":"f594d31c4408b6e1","repo":"Devolutions/UniGetUI","slug":"no-cloud-backups-are-available-for-the-current-acc","errorCode":null,"errorMessage":"No cloud backups are available for the current account.","messagePattern":"No cloud backups are available for the current account\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"src/UniGetUI.Interface.IpcApi/IpcBackupApi.cs","lineNumber":509,"sourceCode":"    private static async Task<GitHubUser> GetAuthenticatedGitHubUserAsync(GitHubApiClient client)\n    {\n        var user = await client.GetCurrentUserAsync();\n        if (!string.IsNullOrWhiteSpace(user.Login))\n        {\n            Settings.SetValue(Settings.K.GitHubUserLogin, user.Login);\n        }\n\n        return user;\n    }\n\n    private static async Task<string> GetCloudBackupContentsAsync(string key)\n    {\n        using var client = CreateAuthenticatedGitHubClient();\n        await GetAuthenticatedGitHubUserAsync(client);\n        var backupGist = await GetBackupGistAsync(client, createIfMissing: false);\n        if (backupGist is null)\n        {\n            throw new InvalidOperationException(\"No cloud backups are available for the current account.\");\n        }\n\n        var fullGist = await client.GetGistAsync(backupGist.Id);\n        var file = fullGist.Files.FirstOrDefault(candidate =>\n            candidate.Key.StartsWith(PackageBackupStartingKey, StringComparison.Ordinal)\n            && candidate.Key.EndsWith(key, StringComparison.Ordinal));\n\n        if (file.Value?.Content is null)\n        {\n            throw new InvalidOperationException($\"The cloud backup \\\"{key}\\\" was not found.\");\n        }\n\n        return file.Value.Content;\n    }\n\n    private static async Task<GitHubGist?> GetBackupGistAsync(\n        GitHubApiClient client,\n        bool createIfMissing","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/Devolutions/UniGetUI/blob/9b1d7d0eab91620fc15c86b36676532095936ae3/src/UniGetUI.Interface.IpcApi/IpcBackupApi.cs#L491-L527","documentation":"GetCloudBackupContentsAsync (used by download and restore) calls GetBackupGistAsync with createIfMissing=false. If no gist with the sentinel description-ending key is found among the user's gists, the method returns null, and GetCloudBackupContentsAsync throws InvalidOperationException. This means the user has authenticated successfully but has never created a cloud backup, or their backup gist was deleted.","triggerScenarios":"DownloadCloudBackupAsync or RestoreCloudBackupAsync is called when the authenticated user has no backup gist. The user never ran CreateCloudBackupAsync, or the gist was manually deleted from their GitHub account, or the gist's description was edited (breaking the sentinel-key detection).","commonSituations":"A new user tries to restore before creating their first backup. The user manually deleted or renamed the gist in GitHub's UI. The gist description was altered so EndsWith(GistDescriptionEndingKey) no longer matches. The user is authenticated with a different GitHub account that has no backup.","solutions":["Call CreateCloudBackupAsync first to create and populate the backup gist.","Verify the correct GitHub account is signed in (check IpcGitHubAuthInfo.Login).","If the gist was renamed/edited, delete the modified gist so a fresh one with the correct description can be created.","List available backups via ListCloudBackupsAsync before attempting download/restore."],"exampleFix":"// before: downloading when no backup gist exists\nawait IpcBackupApi.DownloadCloudBackupAsync(request);\n// after: create a backup first if none exists\nvar entries = await IpcBackupApi.ListCloudBackupsAsync();\nif (entries.Count == 0)\n    await IpcBackupApi.CreateCloudBackupAsync();\nelse\n    await IpcBackupApi.DownloadCloudBackupAsync(request);","handlingStrategy":"validation","validationCode":"var entries = await IpcBackupApi.ListCloudBackupsAsync();\nif (entries.Count == 0)\n    await IpcBackupApi.CreateCloudBackupAsync();","typeGuard":"static bool HasCloudBackup(IReadOnlyList<IpcCloudBackupEntry> entries) => entries.Count > 0;","tryCatchPattern":"try { await IpcBackupApi.DownloadCloudBackupAsync(request); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No cloud backups\"))\n{ /* create a backup first */ }","preventionTips":["List backups before offering download/restore.","Create a backup before attempting to restore on a fresh account.","Do not edit or delete the backup gist description manually."],"tags":["github","backup","gist","restore","ipc"],"backgroundTag":null,"analyzedSha":"9b1d7d0eab91620fc15c86b36676532095936ae3","analyzedAt":"2026-08-13T12:19:18.278Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}