{"record":{"id":"ee43f99af14b3c5d","repo":"huiyadanli/RevokeMsgPatcher","slug":"error-ee43f9","errorCode":null,"errorMessage":"下载失败","messagePattern":"下载失败","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"RevokeMsgPatcher/Model/LiteLoaderRowData.cs","lineNumber":295,"sourceCode":"        }\n\n        private async Task<string> DownloadLatestPackage(string url, string localDirectory)\n        {\n            using (HttpClient client = new HttpClient())\n            {\n                var response = await client.GetAsync(url);\n                if (response.IsSuccessStatusCode)\n                {\n                    var data = await response.Content.ReadAsByteArrayAsync();\n                    var fileName = Path.GetFileName(url);\n                    var localPath = Path.Combine(localDirectory, fileName);\n                    Directory.CreateDirectory(localDirectory); // 确保目录存在\n                    File.WriteAllBytes(localPath, data);\n                    return localPath;\n                }\n                else\n                {\n                    throw new Exception(\"下载失败\");\n                }\n            }\n        }\n\n        private void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs = true)\n        {\n            DirectoryInfo dir = new DirectoryInfo(sourceDirName);\n            DirectoryInfo[] dirs = dir.GetDirectories();\n\n            if (!dir.Exists)\n            {\n                throw new DirectoryNotFoundException(\"源目录不存在: \" + sourceDirName);\n            }\n\n            if (!Directory.Exists(destDirName))\n            {\n                Directory.CreateDirectory(destDirName);\n            }","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/huiyadanli/RevokeMsgPatcher/blob/89cbbb3f0cc896d5d092de0199a635c5c39944b6/RevokeMsgPatcher/Model/LiteLoaderRowData.cs#L277-L313","documentation":"DownloadLatestPackage(url, localDirectory) uses HttpClient.GetAsync to fetch a LiteLoaderQQNT/plugin zip; on any non-success HTTP status (4xx/5xx) it throws a plain Exception('下载失败'). It is the download path used by CheckAndUpdate.","triggerScenarios":"The constructed GitHub download URL returns 404 (release asset renamed/removed), 403 (rate limit), 5xx, or the proxy prefix is malformed so the request fails. The '#{version}' substitution in DownloadUrl produced a dead link.","commonSituations":"Network/proxy misconfigured or unreachable; GitHub rate-limiting; release tag/asset format changed so the version substitution yields an invalid URL.","solutions":["Select a different GitHub proxy in the proxy dropdown and retry.","Retry after a short delay (transient 5xx or rate-limit).","Open the constructed URL in a browser to confirm the release asset for that version still exists; if the format changed, wait for a patcher update."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"string url = FormatUrl(proxyUrl, downloadUrl);\nif (string.IsNullOrWhiteSpace(url))\n{\n    UpdateStatus(\"下载地址无效\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"for (int attempt = 0; attempt < 3; attempt++)\n{\n    try\n    {\n        return await DownloadLatestPackage(url, localDirectory);\n    }\n    catch (Exception ex) when (attempt < 2)\n    {\n        await Task.Delay(TimeSpan.FromSeconds(2 * (attempt + 1)));\n    }\n}","preventionTips":["Let the user pick a working GitHub proxy from the dropdown before downloading.","Surface the HTTP status code in the error so 404 vs rate-limit is distinguishable.","Retry transient failures (5xx / 403) with backoff; fail fast on a hard 404."],"tags":["network","download","liteloaderqqnt"],"backgroundTag":null,"analyzedSha":"89cbbb3f0cc896d5d092de0199a635c5c39944b6","analyzedAt":"2026-08-13T10:37:37.073Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}