{"record":{"id":"a97f14c9c1be7a60","repo":"memstechtips/Winhance","slug":"boot-file-not-found-etfsbootpath","errorCode":null,"errorMessage":"Boot file not found: {etfsbootPath}","messagePattern":"Boot file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Winhance.Infrastructure/Features/AdvancedTools/Services/IsoService.cs","lineNumber":308,"sourceCode":"\r\n            var workingDirSize = _fileSystemService.GetFiles(workingDirectory, \"*\", SearchOption.AllDirectories)\r\n                .Sum(f => _fileSystemService.GetFileSize(f));\r\n\r\n            var requiredSpace = workingDirSize + (2L * 1024 * 1024 * 1024);\r\n\r\n            await _dismProcessRunner.CheckDiskSpaceAsync(outputPath, requiredSpace, \"ISO creation\").ConfigureAwait(false);\r\n\r\n            progress?.Report(new TaskProgressDetail\r\n            {\r\n                StatusText = _localization.GetString(\"Progress_CreatingBootableIso\"),\r\n                TerminalOutput = $\"Output: {outputPath}\"\r\n            });\r\n\r\n            var efisysPath = _fileSystemService.CombinePath(workingDirectory, \"efi\", \"microsoft\", \"boot\", \"efisys.bin\");\r\n            var etfsbootPath = _fileSystemService.CombinePath(workingDirectory, \"boot\", \"etfsboot.com\");\r\n\r\n            if (!_fileSystemService.FileExists(etfsbootPath))\r\n                throw new FileNotFoundException($\"Boot file not found: {etfsbootPath}\");\r\n\r\n            if (!_fileSystemService.FileExists(efisysPath))\r\n                throw new FileNotFoundException($\"UEFI boot file not found: {efisysPath}\");\r\n\r\n            var outputDir = _fileSystemService.GetDirectoryName(outputPath);\r\n            if (!string.IsNullOrEmpty(outputDir) && !_fileSystemService.DirectoryExists(outputDir))\r\n                _fileSystemService.CreateDirectory(outputDir);\r\n\r\n            if (_fileSystemService.FileExists(outputPath))\r\n            {\r\n                _fileSystemService.DeleteFile(outputPath);\r\n                _logService.LogInformation(\"Removed existing ISO file\");\r\n            }\r\n\r\n            var arguments = $\"-m -o -u2 -udfver102 -bootdata:2#p0,e,b\\\"{etfsbootPath}\\\"#pEF,e,b\\\"{efisysPath}\\\" \\\"{workingDirectory}\\\" \\\"{outputPath}\\\"\";\r\n\r\n            progress?.Report(new TaskProgressDetail\r\n            {\r","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/memstechtips/Winhance/blob/f23d554eb2d6400b1827bcc46b91294ffa53fbc9/src/Winhance.Infrastructure/Features/AdvancedTools/Services/IsoService.cs#L290-L326","documentation":"FileNotFoundException thrown during bootable ISO creation when boot\\etfsboot.com is absent from the staged working directory. etfsboot.com is the BIOS/legacy El Torito boot sector that oscdimg embeds via the `#p0,e,b` segment; without it the resulting ISO cannot boot in legacy/CSM mode.","triggerScenarios":"CreateBootableIsoAsync (or equivalent) is called after the source media was staged, but the staging step did not copy the \\boot\\etfsboot.com file. The source ISO/install was a non-standard edition, an ESD converted to WIM without preserving the boot folder, or the working directory was partially cleared before this run.","commonSituations":"Source install media is a modern ESD-based build where the legacy boot sector was stripped. A prior step that copies files into the working directory was interrupted or skipped the boot folder. The working directory path differs from the one populated upstream. An antivirus quarantined etfsboot.com as a suspicious boot file.","solutions":["Verify the source media actually contains \\boot\\etfsboot.com before staging; if missing, obtain complete Windows install media.","Re-run the file-staging step that populates the working directory and confirm it copies the entire \\boot folder recursively.","Add etfsboot.com from a known-good Windows ISO (same build) into <workingDirectory>/boot/ manually, then retry ISO creation.","If the source only supports UEFI booting, use a single-boot oscdimg command line without the #p0 legacy segment instead of failing.","Check antivirus quarantine/history and add the staging folder as an exclusion."],"exampleFix":"// before: hard fail if legacy boot sector absent, even on UEFI-only targets\nif (!_fileSystemService.FileExists(etfsbootPath))\n    throw new FileNotFoundException($\"Boot file not found: {etfsbootPath}\");\n\n// after: report which boot files are present so the user can choose a boot mode\nvar haveLegacy = _fileSystemService.FileExists(etfsbootPath);\nvar haveUefi   = _fileSystemService.FileExists(efisysPath);\nif (!haveLegacy && !haveUefi)\n    throw new FileNotFoundException(\"No boot files found in working directory (missing both boot\\\\etfsboot.com and efi\\\\microsoft\\\\boot\\\\efisys.bin).\");","handlingStrategy":"validation","validationCode":"// Before calling CreateBootableIsoAsync, verify the staged tree has the legacy boot file.\nbool HasLegacyBoot(string workingDirectory)\n{\n    var etfsbootPath = _fileSystemService.CombinePath(workingDirectory, \"boot\", \"etfsboot.com\");\n    return _fileSystemService.FileExists(etfsbootPath);\n}","typeGuard":null,"tryCatchPattern":"catch (System.IO.FileNotFoundException ex) when (ex.Message.Contains(\"etfsboot.com\"))\n{\n    // Prompt user: source media lacks BIOS boot sector; offer UEFI-only ISO or re-stage from complete media.\n}","preventionTips":["Stage install media fully (entire \\\\boot tree) before ISO creation.","Use complete, unmodified Windows ISOs as the source.","Validate the staged tree contains \\boot\\etfsboot.com and \\efi\\microsoft\\boot\\efisys.bin before invoking oscdimg."],"tags":["filesystem","iso","boot","windows","media"],"backgroundTag":null,"analyzedSha":"f23d554eb2d6400b1827bcc46b91294ffa53fbc9","analyzedAt":"2026-08-13T17:55:20.922Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}