{"record":{"id":"14d01cba0a206187","repo":"k1tbyte/Wand-Enhancer","slug":"enhancer-remote-bridge-artifact-is-missing-run","errorCode":null,"errorMessage":"[ENHANCER] Remote bridge artifact is missing. Run `cd web-panel && pnpm run build` before patching.","messagePattern":"\\[ENHANCER\\] Remote bridge artifact is missing\\. Run `cd web-panel && pnpm run build` before patching\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"WandEnhancer/Core/Enhancer.cs","lineNumber":404,"sourceCode":"\n            string localCustomScriptsRoot = FindLocalCustomScriptsPath();\n            string targetRoot = Path.Combine(_unpackedPath, RemotePanelDirectoryName);\n            string targetScriptsRoot = Path.Combine(targetRoot, RemoteRendererScriptsDirectoryName);\n            string targetBridgePath = Path.Combine(targetRoot, RemoteBridgeTargetFileName);\n\n            if (Directory.Exists(targetRoot))\n            {\n                Directory.Delete(targetRoot, true);\n            }\n\n            if (CopyEmbeddedDirectory(EmbeddedRemotePanelDistPrefix, targetRoot) == 0)\n            {\n                CopyDirectory(FindWorkspacePath(WebPanelDirectoryName, WebPanelDistDirectoryName), targetRoot);\n            }\n\n            if (!File.Exists(targetBridgePath))\n            {\n                throw new FileNotFoundException(\"[ENHANCER] Remote bridge artifact is missing. Run `cd web-panel && pnpm run build` before patching.\", targetBridgePath);\n            }\n\n            int defaultScriptCount = Directory.Exists(targetScriptsRoot)\n                ? Directory.GetFiles(targetScriptsRoot, JavaScriptFileSearchPattern, SearchOption.TopDirectoryOnly).Length\n                : 0;\n            if (defaultScriptCount == 0)\n            {\n                throw new FileNotFoundException(\"[ENHANCER] Remote renderer script artifacts are missing. Run `cd web-panel && pnpm run build` before patching.\", targetScriptsRoot);\n            }\n\n            int selectedScriptCount = CopySelectedJavaScriptFiles(_config.CustomScriptPaths, targetScriptsRoot);\n            int localScriptCount = CopyJavaScriptFiles(localCustomScriptsRoot, targetScriptsRoot);\n\n            _logger($\"[ENHANCER] Injected remote panel assets and renderer scripts into app.asar (default: {defaultScriptCount}, selected: {selectedScriptCount}, local: {localScriptCount})\", ELogType.Info);\n        }\n\n        private void AttachProxyDll()\n        {","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/k1tbyte/Wand-Enhancer/blob/643c8f8b62cbb26fd3ac105b92497d9a9c445f08/WandEnhancer/Core/Enhancer.cs#L386-L422","documentation":"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.","triggerScenarios":"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\").","commonSituations":"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.","solutions":["Run `cd web-panel && pnpm run build` (per AGENTS.md this runs type-check, Vite build, then build:bridge into dist).","Verify web-panel/dist/bridge.cjs exists and `node --check web-panel/dist/bridge.cjs` passes.","Ensure the .csproj embeds remote-panel/dist OR run the patcher from the repo root.","Delete resources/app.asar.backup + app.asar.unpacked.backup and re-patch so a fresh extraction picks up the new dist."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm bridge.cjs is buildable/present before patching\nstring bridgeDist = Path.Combine(repoRoot, \"web-panel\", \"dist\", \"bridge.cjs\");\nbool embedded = Assembly.GetExecutingAssembly().GetManifestResourceNames()\n    .Any(n => n.Equals(\"remote-panel/dist/bridge.cjs\", StringComparison.Ordinal));\nif (!embedded && !File.Exists(bridgeDist))\n    throw new InvalidOperationException(\"bridge.cjs missing; run `cd web-panel && pnpm run build`.\");","typeGuard":null,"tryCatchPattern":"try { enhancer.Patch(); }\ncatch (FileNotFoundException ex) when (ex.Message.Contains(\"Remote bridge artifact is missing\")) {\n    // run pnpm build, then re-patch\n}","preventionTips":["Run `pnpm run build` as a pre-build step of the C# project.","Gate the patch button in the UI on bridge.cjs existence.","Always embed dist in shipped binaries."],"tags":["build","web-panel","remote-panel","bridge"],"backgroundTag":null,"analyzedSha":"643c8f8b62cbb26fd3ac105b92497d9a9c445f08","analyzedAt":"2026-08-13T14:17:43.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}