k1tbyte/Wand-Enhancer · error · Exception
[ENHANCER] Failed to pack app.asar: {e.Message}
Error message
[ENHANCER] Failed to pack app.asar: {e.Message} What it means
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.
Source
Thrown at WandEnhancer/Core/Enhancer.cs:498
}
catch (Exception e)
{
throw new Exception($"[ENHANCER] Failed to unpack app.asar: {e.Message}");
}
PatchAsar();
InjectRemotePanelFiles();
try
{
new AsarCreator(_unpackedPath, _asarPath, new CreateOptions
{
Unpack = new Regex(@"^static\\unpacked.*$")
}).CreatePackageWithOptions();
}
catch (Exception e)
{
throw new Exception($"[ENHANCER] Failed to pack app.asar: {e.Message}");
}
AttachProxyDll();
_logger("[ENHANCER] Done!", ELogType.Success);
}
}
}
View on GitHub (pinned to 643c8f8b62)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
// Preflight: nothing should hold app.asar open; ensure free disk space
if (Process.GetProcessesByName(_weModConfig.BrandName).Length > 0)
throw new InvalidOperationException("Wand still running; repack will be blocked.");
if (new DriveInfo(_asarPath).AvailableFreeSpace < 256 * 1024 * 1024)
throw new InvalidOperationException("Insufficient disk space to repack app.asar."); Try / catch
try {
enhancer.Patch();
} catch (Exception ex) when (ex.Message.StartsWith("[ENHANCER] Failed to pack app.asar:")) {
// inner Message holds AsarSharp cause; ensure Wand closed + disk space, retry once
} Prevention
- 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.
When it happens
Trigger: Enhancer.Patch() repack try/catch at Enhancer.cs:489-499: AsarSharp.AsarCreator.CreatePackageWithOptions throws.
Common situations: 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.
Related errors
- [ENHANCER] Failed to unpack app.asar: {e.Message}
- [ENHANCER] No app bundle found
- [ENHANCER] app.asar.unpacked is missing and no backup exists
- app.asar not found
AI-assisted analysis of k1tbyte/Wand-Enhancer@643c8f8b62 (2026-08-13).
Data as JSON: /api/errors/fc6812a106b03204.
Report an issue: GitHub.