netchx/netch · error · MessageException
The downloaded file has the wrong hash
Error message
The downloaded file has the wrong hash
What it means
Thrown by MainForm's update routine when the SHA-256 of the freshly downloaded update file does not equal the expected sha256 from UpdateChecker.GetLatestUpdateFileNameAndHash. The file is present but its content does not match the published hash, so the updater refuses to apply it.
Source
Thrown at Netch/Forms/MainForm.cs:473
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);
}
catch (MessageException exception)
{
NotifyTip(exception.Message, info: false);
}
catch (Exception exception)View on GitHub (pinned to 9d99eb1c5a)
Solutions
- Delete data\<updateFileName> and retry the download to get a clean copy.
- Verify network path integrity (disable interfering proxy/VPN for the download).
- Compare the published sha256 in the release notes against what Utils.Utils.Sha256CheckSumAsync computes locally.
- If the published hash itself is wrong, wait for a corrected release or report it.
- Download the asset manually in a browser, hash it, and only place it in data\ if it matches.
Defensive patterns
Strategy: retry
Validate before calling
// If a partial file exists, recompute and only trust it when it matches.
if (File.Exists(updateFileFullName))
{
if (await Utils.Utils.Sha256CheckSumAsync(updateFileFullName) != sha256)
File.Delete(updateFileFullName); // discard corrupt/partial file
} Try / catch
string fileHash;
do
{
try { await WebUtil.DownloadFileAsync(updateFileUrl, updateFileFullName, progress); }
catch (Exception e1) { throw new MessageException($"Download Update File Failed: {e1.Message}"); }
fileHash = await Utils.Utils.Sha256CheckSumAsync(updateFileFullName);
if (fileHash != sha256) File.Delete(updateFileFullName); // throw away the bad copy and retry
} while (fileHash != shaHash); Prevention
- Delete the mismatched file and re-download — a truncated copy is the usual cause.
- Disable interfering proxies/VPN for the download to avoid byte rewriting.
- Cross-check the published sha256 against the GitHub release notes manually.
- If the published hash is wrong, wait for a corrected release rather than forcing an apply.
When it happens
Trigger: Partial/corrupted download truncated by a dropped connection; a transparent proxy/MITM altered the bytes; the published hash in the release metadata is stale or wrong; the GitHub asset was republished under the same name with different content; disk write corruption.
Common situations: Connection dropped mid-download leaving a truncated file; CDN/cache served a stale or wrong artifact; user is behind a filtering proxy that rewrote the binary.
Related errors
AI-assisted analysis of netchx/netch@9d99eb1c5a (2026-08-13).
Data as JSON: /api/errors/5cfd3202a71d512a.
Report an issue: GitHub.