k1tbyte/Wand-Enhancer · critical · Exception

[ENHANCER] No app bundle found

Error message

[ENHANCER] No app bundle found

What it means

PatchAsar enumerates top-level .js files under _unpackedPath (resources/app.asar.unpacked) and filters via IsCandidateBundleFile, which accepts only index.js or files matching app-*.bundle.js. If nothing passes, there is no bundle to patch and the process aborts.

Source

Thrown at WandEnhancer/Core/Enhancer.cs:130

                    : patch.Target.Replace(js, patchSource);
            }

            _logger($"{prefix} Patch applied", ELogType.Success);
            patch.Applied = true;
            patchApplied = true;
            
            return newJs;
        }

        private void PatchAsar()
        {
            var items = Directory.EnumerateFiles(_unpackedPath, $"*{JavaScriptFileExtension}", SearchOption.TopDirectoryOnly)
                .Where(IsCandidateBundleFile)
                .ToList();

            if (!items.Any())
            {
                throw new Exception("[ENHANCER] No app bundle found");
            }
            
            var remainingPatches = new HashSet<EPatchType>(_config.PatchTypes);
            var enhancerConfig = EnhancerConfig.GetInstance();

            foreach (var item in items)
            {
                if (remainingPatches.Count == 0)
                {
                    break;
                }

                if (!CouldFileContainRemainingPatch(item, remainingPatches, enhancerConfig))
                {
                    continue;
                }
                
                string data = File.ReadAllText(item);

View on GitHub (pinned to 643c8f8b62)

Solutions

  1. Open resources/app.asar.unpacked and confirm it actually contains extracted files.
  2. Verify AsarExtractor.ExtractAll completed without throwing (check [11]).
  3. List the real bundle filenames; if Wand changed convention (no longer index.js / app-*.bundle.js), update IsCandidateBundleFile's constants (IndexBundleFileName / AppBundleFilePrefix / AppBundleFileSuffix).
  4. If the dir is empty/corrupt, reinstall Wand to a known-good state, delete app.asar.backup + app.asar.unpacked.backup, and re-patch.
Defensive patterns

Strategy: validation

Validate before calling

// Verify a candidate bundle exists before patching
var candidates = Directory.EnumerateFiles(_unpackedPath, "*.js", SearchOption.TopDirectoryOnly)
    .Where(f => f.EndsWith("index.js", StringComparison.OrdinalIgnoreCase)
             || (Path.GetFileName(f).StartsWith("app-", StringComparison.OrdinalIgnoreCase)
                 && Path.GetFileName(f).EndsWith(".bundle.js", StringComparison.OrdinalIgnoreCase)));
if (!candidates.Any())
    throw new InvalidOperationException("No candidate bundle in " + _unpackedPath + "; extraction may have failed.");

Try / catch

try { enhancer.Patch(); }
catch (Exception ex) when (ex.Message == "[ENHANCER] No app bundle found") {
    // inspect _unpackedPath, confirm extraction, then reinstall/re-extract
}

Prevention

When it happens

Trigger: PatchAsar() at Enhancer.cs:124-131 after AsarExtractor.ExtractAll ran: Directory.EnumerateFiles(_unpackedPath, "*.js", TopDirectoryOnly).Where(IsCandidateBundleFile) yields an empty list.

Common situations: Extraction produced an empty or partial _unpackedPath (see [11]); Wand renamed/relocated its bundle filename convention; the asar header pointed at a non-standard layout; antivirus quarantined the extracted bundles.

Related errors


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