huiyadanli/RevokeMsgPatcher · error · Exception
下载失败
Error message
下载失败
What it means
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.
Source
Thrown at RevokeMsgPatcher/Model/LiteLoaderRowData.cs:295
}
private async Task<string> DownloadLatestPackage(string url, string localDirectory)
{
using (HttpClient client = new HttpClient())
{
var response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
var data = await response.Content.ReadAsByteArrayAsync();
var fileName = Path.GetFileName(url);
var localPath = Path.Combine(localDirectory, fileName);
Directory.CreateDirectory(localDirectory); // 确保目录存在
File.WriteAllBytes(localPath, data);
return localPath;
}
else
{
throw new Exception("下载失败");
}
}
}
private void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs = true)
{
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
DirectoryInfo[] dirs = dir.GetDirectories();
if (!dir.Exists)
{
throw new DirectoryNotFoundException("源目录不存在: " + sourceDirName);
}
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName);
}View on GitHub (pinned to 89cbbb3f0c)
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.
Defensive patterns
Strategy: retry
Validate before calling
string url = FormatUrl(proxyUrl, downloadUrl);
if (string.IsNullOrWhiteSpace(url))
{
UpdateStatus("下载地址无效");
return;
} Try / catch
for (int attempt = 0; attempt < 3; attempt++)
{
try
{
return await DownloadLatestPackage(url, localDirectory);
}
catch (Exception ex) when (attempt < 2)
{
await Task.Delay(TimeSpan.FromSeconds(2 * (attempt + 1)));
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Network/proxy misconfigured or unreachable; GitHub rate-limiting; release tag/asset format changed so the version substitution yields an invalid URL.
Related errors
- 源目录不存在: {sourceDirName}
- 在路径{appPath}下,未找到package.json.h.bak备份文件,请确认是否通过本软件安装过 LiteLo
- 在路径{appPath}下,未找到app_launcher文件夹
- 在路径{appPath}下,未找到package.json文件
AI-assisted analysis of huiyadanli/RevokeMsgPatcher@89cbbb3f0c (2026-08-13).
Data as JSON: /api/errors/ee43f99af14b3c5d.
Report an issue: GitHub.