netchx/netch · warning · MessageException
Download Update File Failed: {e1.Message}
Error message
Download Update File Failed: {e1.Message} What it means
Thrown by MainForm's update routine when WebUtil.DownloadFileAsync(updateFileUrl, updateFileFullName, progress) raised any exception while fetching the new release asset. The exception is logged as a Warning and rethrown as a MessageException carrying the inner message. The update is aborted (caught upstream and shown as a tip).
Source
Thrown at Netch/Forms/MainForm.cs:468
if (File.Exists(updateFileFullName))
{
var fileHash = await Utils.Utils.Sha256CheckSumAsync(updateFileFullName);
if (fileHash == sha256)
downloaded = true;
else
File.Delete(updateFileFullName);
}
if (!downloaded)
{
try
{
await WebUtil.DownloadFileAsync(updateFileUrl, updateFileFullName, progress);
}
catch (Exception e1)
{
Log.Warning(e1, "Download Update File Failed");
throw new MessageException($"Download Update File Failed: {e1.Message}");
}
var fileHash = await Utils.Utils.Sha256CheckSumAsync(updateFileFullName);
if (fileHash != sha256)
throw new MessageException(i18N.Translate("The downloaded file has the wrong hash"));
}
await StopAsync();
await Configuration.SaveAsync();
// Update
await Task.Run(updater.ApplyUpdate);
// release mutex, exit
Program.SingleInstance.Dispose();
Process.Start(Global.NetchExecutable);
Environment.Exit(0);
}View on GitHub (pinned to 9d99eb1c5a)
Solutions
- Retry the update check/download later (the routine re-validates the hash of any partial file first).
- Check network/proxy connectivity to the release asset URL shown in UpdateChecker.LatestRelease.
- Ensure the data\ download directory is writable and has free space.
- If a proxy is required, configure the system proxy so WebUtil can reach the asset.
- Manually download the asset and place it under data\<updateFileName> so the hash check short-circuits the download.
Defensive patterns
Strategy: retry
Validate before calling
// Best-effort pre-check: ensure the target directory is writable and has space.
Directory.CreateDirectory(Path.GetDirectoryName(updateFileFullName)!);
if (new DriveInfo(Path.GetPathRoot(updateFileFullName)!).AvailableFreeSpace < 50L * 1024 * 1024)
throw new MessageException("Not enough free space for the update download."); Try / catch
for (int attempt = 0; attempt < 3; attempt++)
{
try { await WebUtil.DownloadFileAsync(updateFileUrl, updateFileFullName, progress); break; }
catch (Exception e1) when (attempt < 2)
{
Log.Warning(e1, "Download attempt {N} failed, retrying", attempt + 1);
File.Delete(updateFileFullName); // the hash check below would reject a partial file anyway
}
} Prevention
- Treat download failures as transient — retry a few times before surfacing.
- Validate free disk space and writability of the data\ folder before downloading.
- Ensure the system proxy (if any) can reach GitHub release assets.
- Pre-place a verified asset in data\ so the hash check short-circuits the download.
When it happens
Trigger: Network interruption or timeout during download; update server returned 5xx or a broken URL; proxy/firewall blocking the GitHub release asset; disk full at the download path; the pre-existing file was deleted and a transient error occurred re-fetching.
Common situations: Unstable connection mid-download; corporate proxy blocking github release downloads; the selected release asset URL changed; transient server-side error.
Related errors
- The downloaded file has the wrong hash
- Lookup Server hostname failed
- The {0} port is in use.
- The {0} port is used by {1}.
- GetBestRoute 搜索失败
AI-assisted analysis of netchx/netch@9d99eb1c5a (2026-08-13).
Data as JSON: /api/errors/e216dd7c477e4c7e.
Report an issue: GitHub.