netchx/netch · error · MessageException
Update file main program not exist
Error message
Update file main program not exist
What it means
After confirming the top-level 'Netch' directory exists, the updater requires Netch.exe inside it (Path.Combine(updateDirectory, "Netch.exe")). A missing executable means the package is incomplete (truncated or a wrong/partial variant), and the update is aborted before MarkFilesOld/MoveFilesOver run, to avoid leaving the install broken.
Source
Thrown at Netch/Services/Updater.cs:47
#region Apply Update
internal void ApplyUpdate()
{
var extractPath = Path.Combine(_tempDirectory, "extract");
int exitCode;
if ((exitCode = Extract(extractPath)) != 0)
throw new MessageException(i18N.Translate($"7za unexpectedly exited. ({exitCode})"));
// update archive file must have a top-level directory "Netch"
var updateDirectory = Path.Combine(extractPath, "Netch");
if (!Directory.Exists(updateDirectory))
throw new MessageException(i18N.Translate("Update file top-level directory not exist"));
// {_tempDirectory}/extract/Netch/Netch.exe
var updateMainProgramFilePath = Path.Combine(updateDirectory, "Netch.exe");
if (!File.Exists(updateMainProgramFilePath))
throw new MessageException(i18N.Translate($"Update file main program not exist"));
MarkFilesOld();
// move {tempDirectory}\extract\Netch to install folder
MoveFilesOver(updateDirectory, InstallDirectory);
}
private void MarkFilesOld()
{
var keepDirFullPath = KeepDirectories.Select(d => Path.Combine(InstallDirectory, d)).ToImmutableList();
foreach (var file in Directory.GetFiles(InstallDirectory, "*", SearchOption.AllDirectories))
{
if (keepDirFullPath.Any(p => file.StartsWith(p)))
continue;
if (KeepFiles.Contains(Path.GetFileName(file)))
continue;View on GitHub (pinned to 9d99eb1c5a)
Solutions
- Re-download the complete package and verify its SHA256.
- Confirm the package is the full release, not a delta/patch variant.
- Whitelist the Netch folder in antivirus so Netch.exe is not removed post-extract.
- Inspect the extracted 'Netch' folder to see which critical files are missing.
Example fix
// before
var updateMainProgramFilePath = Path.Combine(updateDirectory, "Netch.exe");
if (!File.Exists(updateMainProgramFilePath))
throw new MessageException(i18N.Translate($"Update file main program not exist"));
// after - validate all critical files and report which are missing
var required = new[] { "Netch.exe" };
var missing = required.Where(f => !File.Exists(Path.Combine(updateDirectory, f))).ToList();
if (missing.Any())
throw new MessageException($"Update package missing: {string.Join(", ", missing)}"); Defensive patterns
Strategy: validation
Validate before calling
var exe = Path.Combine(updateDirectory, "Netch.exe");
if (!File.Exists(exe) || new FileInfo(exe).Length == 0)
throw new MessageException("Update package is missing a valid Netch.exe"); Try / catch
try { updater.ApplyUpdate(); }
catch (MessageException ex) when (ex.Message.Contains("main program not exist"))
{
Log.Error("Update package incomplete: {Msg}", ex.Message);
Global.MainForm.NotifyTip("Update incomplete (no Netch.exe). Re-download the full release.");
} Prevention
- Hash-verify the full archive so truncation is caught before extraction.
- Have the release script assert Netch.exe is present in the staged 'Netch' folder.
- Keep MarkFilesOld strictly after all critical files are confirmed present.
When it happens
Trigger: Archive contains the 'Netch' folder but not Netch.exe: a partial/truncated archive, a debug-only build package, a delta/patch variant, or antivirus removing Netch.exe from the extracted folder.
Common situations: Truncated download that 7za still partially extracted; a release package variant that omits the main exe; AV quarantine of Netch.exe after extraction.
Related errors
AI-assisted analysis of netchx/netch@9d99eb1c5a (2026-08-13).
Data as JSON: /api/errors/2103a76f78a0bc57.
Report an issue: GitHub.