k1tbyte/Wand-Enhancer · error · FileNotFoundException

[ENHANCER] Remote bridge artifact is missing. Run `cd web-pa

Error message

[ENHANCER] Remote bridge artifact is missing. Run `cd web-panel && pnpm run build` before patching.

What it means

After copying embedded remote-panel resources (or the workspace web-panel/dist fallback), the bridge artifact bridge.cjs must exist at <_unpackedPath>/remote-panel/bridge.cjs. Its absence means the Electron main-process bridge was never built. The bridge is the runtime hook that installs the remote panel into Wand's process.

Source

Thrown at WandEnhancer/Core/Enhancer.cs:404

            string localCustomScriptsRoot = FindLocalCustomScriptsPath();
            string targetRoot = Path.Combine(_unpackedPath, RemotePanelDirectoryName);
            string targetScriptsRoot = Path.Combine(targetRoot, RemoteRendererScriptsDirectoryName);
            string targetBridgePath = Path.Combine(targetRoot, RemoteBridgeTargetFileName);

            if (Directory.Exists(targetRoot))
            {
                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()
        {

View on GitHub (pinned to 643c8f8b62)

Solutions

  1. Run `cd web-panel && pnpm run build` (per AGENTS.md this runs type-check, Vite build, then build:bridge into dist).
  2. Verify web-panel/dist/bridge.cjs exists and `node --check web-panel/dist/bridge.cjs` passes.
  3. Ensure the .csproj embeds remote-panel/dist OR run the patcher from the repo root.
  4. Delete resources/app.asar.backup + app.asar.unpacked.backup and re-patch so a fresh extraction picks up the new dist.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm bridge.cjs is buildable/present before patching
string bridgeDist = Path.Combine(repoRoot, "web-panel", "dist", "bridge.cjs");
bool embedded = Assembly.GetExecutingAssembly().GetManifestResourceNames()
    .Any(n => n.Equals("remote-panel/dist/bridge.cjs", StringComparison.Ordinal));
if (!embedded && !File.Exists(bridgeDist))
    throw new InvalidOperationException("bridge.cjs missing; run `cd web-panel && pnpm run build`.");

Try / catch

try { enhancer.Patch(); }
catch (FileNotFoundException ex) when (ex.Message.Contains("Remote bridge artifact is missing")) {
    // run pnpm build, then re-patch
}

Prevention

When it happens

Trigger: InjectRemotePanelFiles at Enhancer.cs:402-405 with EPatchType.RemoteWebPanelPreview enabled: after CopyEmbeddedDirectory + CopyDirectory, File.Exists(targetBridgePath) is false where targetBridgePath = Path.Combine(targetRoot, "bridge.cjs").

Common situations: Developer ran the patcher without first running `pnpm run build:bridge`; web-panel/dist is stale or empty; the bridge output path moved in the vite/bridge config; the .csproj did not embed remote-panel/dist so it relied on the missing workspace fallback.

Related errors


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