{"record":{"id":"612788d888549a28","repo":"k1tbyte/Wand-Enhancer","slug":"enhancer-failed-to-unpack-app-asar-e-message","errorCode":null,"errorMessage":"[ENHANCER] Failed to unpack app.asar: {e.Message}","messagePattern":"\\[ENHANCER\\] Failed to unpack app\\.asar: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"WandEnhancer/Core/Enhancer.cs","lineNumber":483,"sourceCode":"            }\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\n                {\n                    Unpack = new Regex(@\"^static\\\\unpacked.*$\")\n                }).CreatePackageWithOptions();\n            }\n            catch (Exception e)\n            {\n                throw new Exception($\"[ENHANCER] Failed to pack app.asar: {e.Message}\");\n            }\n            \n            AttachProxyDll();","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/k1tbyte/Wand-Enhancer/blob/643c8f8b62cbb26fd3ac105b92497d9a9c445f08/WandEnhancer/Core/Enhancer.cs#L465-L501","documentation":"AsarExtractor.ExtractAll(_asarPath, _unpackedPath) threw and the exception is wrapped with its inner Message. Per AGENTS.md the extractor intentionally skips in-place self-copies and missing unpacked source entries, so a throw here usually means the asar header/pickle framing is corrupt, the file is not a valid asar, or there is a disk/access error.","triggerScenarios":"Enhancer.Patch() extraction try/catch at Enhancer.cs:476-484: AsarSharp.AsarExtractor.ExtractAll throws.","commonSituations":"app.asar truncated/corrupted by an interrupted prior patch or disk error; file still locked by a running Wand process; a non-asar file sitting at that path; AsarSharp version incompatibility.","solutions":["Ensure Wand is fully terminated before patching (Patch calls TryKillProcess first — confirm no Wand.exe remains).","Restore app.asar from app.asar.backup, or reinstall Wand.","Read the inner exception message in the wrapped error for the concrete cause.","Verify disk space and write permissions on _unpackedPath."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Best-effort preflight: confirm asar is readable and Wand is not running\nif (Process.GetProcessesByName(_weModConfig.BrandName).Length > 0)\n    throw new InvalidOperationException(\"Wand is still running; close it before patching.\");\nusing (var fs = File.OpenRead(_asarPath)) { /* header readable */ }","typeGuard":null,"tryCatchPattern":"try {\n    enhancer.Patch();\n} catch (Exception ex) when (ex.Message.StartsWith(\"[ENHANCER] Failed to unpack app.asar:\")) {\n    // inner Message has the AsarSharp cause; restore from app.asar.backup or reinstall\n}","preventionTips":["Always kill Wand before patching so app.asar is not locked.","Keep app.asar.backup so a corrupt asar can be restored.","Log the inner exception for diagnosis."],"tags":["asar","extraction","asarsharp","filesystem"],"backgroundTag":null,"analyzedSha":"643c8f8b62cbb26fd3ac105b92497d9a9c445f08","analyzedAt":"2026-08-13T14:17:43.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}