k1tbyte/Wand-Enhancer · error · FileNotFoundException

[ENHANCER] Remote renderer script artifacts are missing. Run

Error message

[ENHANCER] Remote renderer script artifacts are missing. Run `cd web-panel && pnpm run build` before patching.

What it means

After the bridge.cjs check, the renderer-scripts directory (<_unpackedPath>/remote-panel/renderer-scripts) must contain at least one top-level .js file. Zero files means the default renderer-script build step — build:bridge bundles scripts/default/*.js into dist/renderer-scripts — did not run or produced nothing.

Source

Thrown at WandEnhancer/Core/Enhancer.cs:412

                Directory.Delete(targetRoot, true);
            }

            if (CopyEmbeddedDirectory(EmbeddedRemotePanelDistPrefix, targetRoot) == 0)
            {
                CopyDirectory(FindWorkspacePath(WebPanelDirectoryName, WebPanelDistDirectoryName), targetRoot);
            }

            if (!File.Exists(targetBridgePath))
            {
                throw new FileNotFoundException("[ENHANCER] Remote bridge artifact is missing. Run `cd web-panel && pnpm run build` before patching.", targetBridgePath);
            }

            int defaultScriptCount = Directory.Exists(targetScriptsRoot)
                ? Directory.GetFiles(targetScriptsRoot, JavaScriptFileSearchPattern, SearchOption.TopDirectoryOnly).Length
                : 0;
            if (defaultScriptCount == 0)
            {
                throw new FileNotFoundException("[ENHANCER] Remote renderer script artifacts are missing. Run `cd web-panel && pnpm run build` before patching.", targetScriptsRoot);
            }

            int selectedScriptCount = CopySelectedJavaScriptFiles(_config.CustomScriptPaths, targetScriptsRoot);
            int localScriptCount = CopyJavaScriptFiles(localCustomScriptsRoot, targetScriptsRoot);

            _logger($"[ENHANCER] Injected remote panel assets and renderer scripts into app.asar (default: {defaultScriptCount}, selected: {selectedScriptCount}, local: {localScriptCount})", ELogType.Info);
        }

        private void AttachProxyDll()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var dll = assembly.GetManifestResourceStream(Constants.ProxyDllResouceName);
            if (dll == null)
            {
                throw new Exception("[ENHANCER] Proxy DLL resource not found");
            }
            var destPath = Path.Combine(_weModConfig.RootDirectory, "version.dll");
            using (var fileStream = File.Create(destPath))

View on GitHub (pinned to 643c8f8b62)

Solutions

  1. Run `cd web-panel && pnpm run build` end-to-end.
  2. Verify web-panel/dist/renderer-scripts/*.js exist (e.g. remote-popup-cleanup.js, installed-apps-sync.js per AGENTS.md) and `node --check` passes on each.
  3. Check the build:bridge script in web-panel/package.json bundles scripts/default/ into dist/renderer-scripts.
  4. Re-run the patch after a clean build.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm renderer scripts are present before patching
string scriptsDir = Path.Combine(repoRoot, "web-panel", "dist", "renderer-scripts");
int count = Directory.Exists(scriptsDir)
    ? Directory.GetFiles(scriptsDir, "*.js", SearchOption.TopDirectoryOnly).Length : 0;
if (count == 0)
    throw new InvalidOperationException("No renderer scripts in dist/renderer-scripts; run `cd web-panel && pnpm run build`.");

Try / catch

try { enhancer.Patch(); }
catch (FileNotFoundException ex) when (ex.Message.Contains("Remote renderer script artifacts are missing")) {
    // run pnpm build (build:bridge step), then re-patch
}

Prevention

When it happens

Trigger: InjectRemotePanelFiles at Enhancer.cs:407-413: Directory.GetFiles(targetScriptsRoot, "*.js", TopDirectoryOnly).Length == 0 (or targetScriptsRoot does not exist).

Common situations: build:bridge step skipped or failed; web-panel/bridge/scripts/default/ is empty in source; output directory misconfigured in the build script; an interrupted build left dist partially populated (bridge.cjs present but no scripts).

Related errors


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