{"record":{"id":"fc6812a106b03204","repo":"k1tbyte/Wand-Enhancer","slug":"enhancer-failed-to-pack-app-asar-e-message","errorCode":null,"errorMessage":"[ENHANCER] Failed to pack app.asar: {e.Message}","messagePattern":"\\[ENHANCER\\] Failed to pack app\\.asar: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"WandEnhancer/Core/Enhancer.cs","lineNumber":498,"sourceCode":"            }\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();\n            \n            _logger(\"[ENHANCER] Done!\", ELogType.Success);\n        }\n    }\n}\n","sourceCodeStart":480,"sourceCodeEnd":507,"githubUrl":"https://github.com/k1tbyte/Wand-Enhancer/blob/643c8f8b62cbb26fd3ac105b92497d9a9c445f08/WandEnhancer/Core/Enhancer.cs#L480-L507","documentation":"After PatchAsar + InjectRemotePanelFiles, AsarCreator(_unpackedPath, _asarPath, CreateOptions{Unpack=^static\\\\unpacked.*$}).CreatePackageWithOptions() threw; the exception is wrapped with its inner Message. This is the repack that re-bundles the patched unpacked tree back into app.asar.","triggerScenarios":"Enhancer.Patch() repack try/catch at Enhancer.cs:489-499: AsarSharp.AsarCreator.CreatePackageWithOptions throws.","commonSituations":"Wand still holds a handle on app.asar (did not fully exit); antivirus locking the file; disk full; an injected asset is too large; permission denied overwriting app.asar; a locked file under static/unpacked.","solutions":["Confirm Wand.exe is fully terminated (Task Manager) before re-running.","Free disk space on the install volume.","Read the inner exception message for the concrete cause.","Run the patcher as administrator if app.asar is access-denied.","Exclude the Wand install directory in antivirus."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Preflight: nothing should hold app.asar open; ensure free disk space\nif (Process.GetProcessesByName(_weModConfig.BrandName).Length > 0)\n    throw new InvalidOperationException(\"Wand still running; repack will be blocked.\");\nif (new DriveInfo(_asarPath).AvailableFreeSpace < 256 * 1024 * 1024)\n    throw new InvalidOperationException(\"Insufficient disk space to repack app.asar.\");","typeGuard":null,"tryCatchPattern":"try {\n    enhancer.Patch();\n} catch (Exception ex) when (ex.Message.StartsWith(\"[ENHANCER] Failed to pack app.asar:\")) {\n    // inner Message holds AsarSharp cause; ensure Wand closed + disk space, retry once\n}","preventionTips":["Confirm Wand is fully exited before repack.","Run patcher elevated if app.asar is access-denied.","Keep injected assets small to avoid size limits.","Exclude the Wand directory from antivirus locking."],"tags":["asar","repack","asarsharp","filesystem"],"backgroundTag":null,"analyzedSha":"643c8f8b62cbb26fd3ac105b92497d9a9c445f08","analyzedAt":"2026-08-13T14:17:43.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}