{"record":{"id":"e216dd7c477e4c7e","repo":"netchx/netch","slug":"download-update-file-failed-e1-message","errorCode":null,"errorMessage":"Download Update File Failed: {e1.Message}","messagePattern":"Download Update File Failed: (.+?)","errorType":"exception","errorClass":"MessageException","httpStatus":null,"severity":"warning","filePath":"Netch/Forms/MainForm.cs","lineNumber":468,"sourceCode":"            if (File.Exists(updateFileFullName))\n            {\n                var fileHash = await Utils.Utils.Sha256CheckSumAsync(updateFileFullName);\n                if (fileHash == sha256)\n                    downloaded = true;\n                else\n                    File.Delete(updateFileFullName);\n            }\n\n            if (!downloaded)\n            {\n                try\n                {\n                    await WebUtil.DownloadFileAsync(updateFileUrl, updateFileFullName, progress);\n                }\n                catch (Exception e1)\n                {\n                    Log.Warning(e1, \"Download Update File Failed\");\n                    throw new MessageException($\"Download Update File Failed: {e1.Message}\");\n                }\n\n                var fileHash = await Utils.Utils.Sha256CheckSumAsync(updateFileFullName);\n                if (fileHash != sha256)\n                    throw new MessageException(i18N.Translate(\"The downloaded file has the wrong hash\"));\n            }\n\n            await StopAsync();\n            await Configuration.SaveAsync();\n\n            // Update\n            await Task.Run(updater.ApplyUpdate);\n\n            // release mutex, exit\n            Program.SingleInstance.Dispose();\n            Process.Start(Global.NetchExecutable);\n            Environment.Exit(0);\n        }","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/netchx/netch/blob/9d99eb1c5a2acbf2a34f2600f94242601019a300/Netch/Forms/MainForm.cs#L450-L486","documentation":"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).","triggerScenarios":"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.","commonSituations":"Unstable connection mid-download; corporate proxy blocking github release downloads; the selected release asset URL changed; transient server-side error.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Best-effort pre-check: ensure the target directory is writable and has space.\nDirectory.CreateDirectory(Path.GetDirectoryName(updateFileFullName)!);\nif (new DriveInfo(Path.GetPathRoot(updateFileFullName)!).AvailableFreeSpace < 50L * 1024 * 1024)\n    throw new MessageException(\"Not enough free space for the update download.\");","typeGuard":null,"tryCatchPattern":"for (int attempt = 0; attempt < 3; attempt++)\n{\n    try { await WebUtil.DownloadFileAsync(updateFileUrl, updateFileFullName, progress); break; }\n    catch (Exception e1) when (attempt < 2)\n    {\n        Log.Warning(e1, \"Download attempt {N} failed, retrying\", attempt + 1);\n        File.Delete(updateFileFullName); // the hash check below would reject a partial file anyway\n    }\n}","preventionTips":["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."],"tags":["update","network","download","retry"],"backgroundTag":null,"analyzedSha":"9d99eb1c5a2acbf2a34f2600f94242601019a300","analyzedAt":"2026-08-13T14:12:19.105Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}