{"record":{"id":"12c0e7bb8ef75fde","repo":"k1tbyte/Wand-Enhancer","slug":"enhancer-app-asar-unpacked-is-missing-and-no-bac","errorCode":null,"errorMessage":"[ENHANCER] app.asar.unpacked is missing and no backup exists. Restore the original Wand installation files or reinstall Wand, then patch again.","messagePattern":"\\[ENHANCER\\] app\\.asar\\.unpacked is missing and no backup exists\\. Restore the original Wand installation files or reinstall Wand, then patch again\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"WandEnhancer/Core/Enhancer.cs","lineNumber":468,"sourceCode":"\n            if (!Directory.Exists(_unpackedBackupPath) && Directory.Exists(_unpackedPath))\n            {\n                _logger(\"[ENHANCER] Creating backup of app.asar.unpacked...\", ELogType.Info);\n                CopyDirectory(_unpackedPath, _unpackedBackupPath);\n            }\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();","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/k1tbyte/Wand-Enhancer/blob/643c8f8b62cbb26fd3ac105b92497d9a9c445f08/WandEnhancer/Core/Enhancer.cs#L450-L486","documentation":"Before patching, Patch() guarantees a pristine resources/app.asar.unpacked. If neither a backup (app.asar.unpacked.backup) nor the live app.asar.unpacked exists, it cannot proceed — the extraction step expects the directory and there is nothing to restore from. The message instructs a reinstall.","triggerScenarios":"Enhancer.Patch() at Enhancer.cs:466-469: !Directory.Exists(_unpackedBackupPath) && !Directory.Exists(_unpackedPath) — first run on an install where the unpacked dir was already removed and no prior backup was ever captured.","commonSituations":"User or a cleaner/antivirus deleted resources/app.asar.unpacked; a partial uninstall; a Wand installer variant that ships without the unpacked directory; the dir was moved to a different location.","solutions":["Reinstall Wand to restore resources/app.asar.unpacked.","Restore from a known-good Wand backup copy.","Once app.asar.unpacked exists, the first successful patch run creates app.asar.unpacked.backup for future recovery.","Add the Wand install directory to antivirus exclusions to prevent re-quarantine."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify recoverable unpacked state before patching\nbool hasUnpacked = Directory.Exists(_unpackedPath);\nbool hasBackup  = Directory.Exists(_unpackedBackupPath);\nif (!hasUnpacked && !hasBackup)\n    throw new InvalidOperationException(\"app.asar.unpacked missing with no backup; reinstall Wand before patching.\");","typeGuard":null,"tryCatchPattern":"try { enhancer.Patch(); }\ncatch (Exception ex) when (ex.Message.Contains(\"app.asar.unpacked is missing and no backup exists\")) {\n    // prompt user to reinstall Wand\n}","preventionTips":["On first successful patch, always capture app.asar.unpacked.backup.","Add the Wand directory to antivirus exclusions.","Pre-check unpacked + backup presence in the UI before enabling Patch."],"tags":["install-state","filesystem","recovery","asar"],"backgroundTag":null,"analyzedSha":"643c8f8b62cbb26fd3ac105b92497d9a9c445f08","analyzedAt":"2026-08-13T14:17:43.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}