{"record":{"id":"ce9ea2bc4ddf2aac","repo":"k1tbyte/Wand-Enhancer","slug":"app-asar-not-found","errorCode":null,"errorMessage":"app.asar not found","messagePattern":"app\\.asar not found","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"WandEnhancer/Core/Enhancer.cs","lineNumber":473,"sourceCode":"            }\n            else if (Directory.Exists(_unpackedBackupPath))\n            {\n                _logger(\"[ENHANCER] Restoring pristine app.asar.unpacked before patching...\", ELogType.Info);\n                if (Directory.Exists(_unpackedPath))\n                {\n                    Directory.Delete(_unpackedPath, true);\n                }\n\n                CopyDirectory(_unpackedBackupPath, _unpackedPath);\n            }\n            else if (!Directory.Exists(_unpackedPath))\n            {\n                throw new Exception(\"[ENHANCER] app.asar.unpacked is missing and no backup exists. Restore the original Wand installation files or reinstall Wand, then patch again.\");\n            }\n\n            if(!File.Exists(_asarPath))\n            {\n                throw new Exception(\"app.asar not found\");\n            }\n\n            try\n            {\n                _logger(\"[ENHANCER] Extracting app.asar...\", ELogType.Info);\n                AsarExtractor.ExtractAll(_asarPath, _unpackedPath);\n            }\n            catch (Exception e)\n            {\n                throw new Exception($\"[ENHANCER] Failed to unpack app.asar: {e.Message}\");\n            }\n            \n            PatchAsar();\n            InjectRemotePanelFiles();\n\n            try\n            {\n                new AsarCreator(_unpackedPath, _asarPath, new CreateOptions","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/k1tbyte/Wand-Enhancer/blob/643c8f8b62cbb26fd3ac105b92497d9a9c445f08/WandEnhancer/Core/Enhancer.cs#L455-L491","documentation":"After the backup/restore block, Patch() requires File.Exists(_asarPath) where _asarPath = <RootDirectory>/resources/app.asar. Without it neither extraction nor repack can run. Note CheckWeModPath already required this file when PatchConfig.Path was set, so hitting it means the file disappeared mid-flow.","triggerScenarios":"Enhancer.Patch() at Enhancer.cs:471-474: after the app.asar.backup copy/restore logic, File.Exists(_asarPath) is false.","commonSituations":"Another process/antivirus deleted app.asar between path validation and Patch(); user moved the install; a corrupt app.asar.backup was restored over app.asar and left it missing; disk error.","solutions":["Verify <RootDirectory>/resources/app.asar exists in Explorer.","Reinstall/repair Wand if it is gone or zero-length.","Re-run Extensions.CheckWeModPath immediately before Patch() to fail fast.","Check antivirus quarantine and add an exclusion for the Wand directory."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Re-validate the asar exists immediately before patching\nif (!File.Exists(Path.Combine(_weModConfig.RootDirectory, \"resources\", \"app.asar\")))\n    throw new InvalidOperationException(\"app.asar vanished since path validation; reinstall Wand.\");","typeGuard":null,"tryCatchPattern":"try { enhancer.Patch(); }\ncatch (Exception ex) when (ex.Message == \"app.asar not found\") {\n    // reinstall / restore app.asar\n}","preventionTips":["Call Extensions.CheckWeModPath right before Patch(), not only at config time.","Exclude the Wand dir from antivirus to prevent mid-flow deletion.","Surface a clear reinstall prompt when app.asar is missing."],"tags":["install-state","filesystem","asar"],"backgroundTag":null,"analyzedSha":"643c8f8b62cbb26fd3ac105b92497d9a9c445f08","analyzedAt":"2026-08-13T14:17:43.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}