k1tbyte/Wand-Enhancer · critical · Exception

app.asar not found

Error message

app.asar not found

What it means

After the backup/restore block, Patch() requires File.Exists(_asarPath) where _asarPath = <RootDirectory>/resources/app.asar. Without it neither extraction nor repack can run. Note CheckWeModPath already required this file when PatchConfig.Path was set, so hitting it means the file disappeared mid-flow.

Source

Thrown at WandEnhancer/Core/Enhancer.cs:473

            }
            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();
            InjectRemotePanelFiles();

            try
            {
                new AsarCreator(_unpackedPath, _asarPath, new CreateOptions

View on GitHub (pinned to 643c8f8b62)

Solutions

  1. Verify <RootDirectory>/resources/app.asar exists in Explorer.
  2. Reinstall/repair Wand if it is gone or zero-length.
  3. Re-run Extensions.CheckWeModPath immediately before Patch() to fail fast.
  4. Check antivirus quarantine and add an exclusion for the Wand directory.
Defensive patterns

Strategy: validation

Validate before calling

// Re-validate the asar exists immediately before patching
if (!File.Exists(Path.Combine(_weModConfig.RootDirectory, "resources", "app.asar")))
    throw new InvalidOperationException("app.asar vanished since path validation; reinstall Wand.");

Try / catch

try { enhancer.Patch(); }
catch (Exception ex) when (ex.Message == "app.asar not found") {
    // reinstall / restore app.asar
}

Prevention

When it happens

Trigger: Enhancer.Patch() at Enhancer.cs:471-474: after the app.asar.backup copy/restore logic, File.Exists(_asarPath) is false.

Common situations: Another process/antivirus deleted app.asar between path validation and Patch(); user moved the install; a corrupt app.asar.backup was restored over app.asar and left it missing; disk error.

Related errors


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