k1tbyte/Wand-Enhancer · error · Exception

[ENHANCER] app.asar.unpacked is missing and no backup exists

Error message

[ENHANCER] app.asar.unpacked is missing and no backup exists. Restore the original Wand installation files or reinstall Wand, then patch again.

What it means

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.

Source

Thrown at WandEnhancer/Core/Enhancer.cs:468

            if (!Directory.Exists(_unpackedBackupPath) && Directory.Exists(_unpackedPath))
            {
                _logger("[ENHANCER] Creating backup of app.asar.unpacked...", ELogType.Info);
                CopyDirectory(_unpackedPath, _unpackedBackupPath);
            }
            else if (Directory.Exists(_unpackedBackupPath))
            {
                _logger("[ENHANCER] Restoring pristine app.asar.unpacked before patching...", ELogType.Info);
                if (Directory.Exists(_unpackedPath))
                {
                    Directory.Delete(_unpackedPath, true);
                }

                CopyDirectory(_unpackedBackupPath, _unpackedPath);
            }
            else if (!Directory.Exists(_unpackedPath))
            {
                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.");
            }

            if(!File.Exists(_asarPath))
            {
                throw new Exception("app.asar not found");
            }

            try
            {
                _logger("[ENHANCER] Extracting app.asar...", ELogType.Info);
                AsarExtractor.ExtractAll(_asarPath, _unpackedPath);
            }
            catch (Exception e)
            {
                throw new Exception($"[ENHANCER] Failed to unpack app.asar: {e.Message}");
            }
            
            PatchAsar();

View on GitHub (pinned to 643c8f8b62)

Solutions

  1. Reinstall Wand to restore resources/app.asar.unpacked.
  2. Restore from a known-good Wand backup copy.
  3. Once app.asar.unpacked exists, the first successful patch run creates app.asar.unpacked.backup for future recovery.
  4. Add the Wand install directory to antivirus exclusions to prevent re-quarantine.
Defensive patterns

Strategy: validation

Validate before calling

// Verify recoverable unpacked state before patching
bool hasUnpacked = Directory.Exists(_unpackedPath);
bool hasBackup  = Directory.Exists(_unpackedBackupPath);
if (!hasUnpacked && !hasBackup)
    throw new InvalidOperationException("app.asar.unpacked missing with no backup; reinstall Wand before patching.");

Try / catch

try { enhancer.Patch(); }
catch (Exception ex) when (ex.Message.Contains("app.asar.unpacked is missing and no backup exists")) {
    // prompt user to reinstall Wand
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of k1tbyte/Wand-Enhancer@643c8f8b62 (2026-08-13). Data as JSON: /api/errors/12c0e7bb8ef75fde. Report an issue: GitHub.