{"record":{"id":"d8ecede212a3a961","repo":"k1tbyte/Wand-Enhancer","slug":"required-workspace-artifact-not-found-path-combi","errorCode":null,"errorMessage":"Required workspace artifact not found: {Path.Combine(segments)}","messagePattern":"Required workspace artifact not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"WandEnhancer/Core/Enhancer.cs","lineNumber":244,"sourceCode":"\n            return searchHints.Any(searchHint => source.IndexOf(searchHint, StringComparison.Ordinal) >= 0);\n        }\n\n        private static string FindWorkspacePath(params string[] segments)\n        {\n            string current = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);\n            while (!string.IsNullOrEmpty(current))\n            {\n                string candidate = Path.Combine(new[] { current }.Concat(segments).ToArray());\n                if (Directory.Exists(candidate) || File.Exists(candidate))\n                {\n                    return candidate;\n                }\n\n                current = Directory.GetParent(current)?.FullName;\n            }\n\n            throw new FileNotFoundException($\"Required workspace artifact not found: {Path.Combine(segments)}\");\n        }\n\n        internal static void CopyDirectory(string sourceDir, string destinationDir)\n        {\n            Directory.CreateDirectory(destinationDir);\n\n            foreach (var directory in Directory.GetDirectories(sourceDir, \"*\", SearchOption.AllDirectories))\n            {\n                var relativePath = directory.Substring(sourceDir.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);\n                Directory.CreateDirectory(Path.Combine(destinationDir, relativePath));\n            }\n\n            foreach (var file in Directory.GetFiles(sourceDir, \"*\", SearchOption.AllDirectories))\n            {\n                var relativePath = file.Substring(sourceDir.Length).TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);\n                var destinationPath = Path.Combine(destinationDir, relativePath);\n                Directory.CreateDirectory(Path.GetDirectoryName(destinationPath) ?? destinationDir);\n                File.Copy(file, destinationPath, true);","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/k1tbyte/Wand-Enhancer/blob/643c8f8b62cbb26fd3ac105b92497d9a9c445f08/WandEnhancer/Core/Enhancer.cs#L226-L262","documentation":"FindWorkspacePath walks up from the assembly's directory looking for a relative path built from the given segments (used for web-panel/dist). It is only reached as a dev fallback when CopyEmbeddedDirectory(EmbeddedRemotePanelDistPrefix) returned 0 — i.e. no remote-panel/dist resources are embedded in the assembly — and the on-disk workspace path also cannot be located.","triggerScenarios":"InjectRemotePanelFiles at Enhancer.cs:397-399: CopyEmbeddedDirectory(\"remote-panel/dist/\", targetRoot) == 0, so it calls FindWorkspacePath(\"web-panel\", \"dist\"); the walk-up from Assembly.Location never finds a web-panel/dist directory.","commonSituations":"Running a shipped/published exe outside the repo without embedding remote-panel resources; invoking the patcher from a copied location not nested under the workspace root; the .csproj does not embed the dist tree so the dev fallback is required but unavailable.","solutions":["Run the patcher from within the repo workspace where web-panel/dist exists, OR","Ensure the build embeds remote-panel/dist resources into the assembly (check the EmbeddedResource / LogicalName entries in the .csproj).","Run `cd web-panel && pnpm run build` first so web-panel/dist is populated.","Place web-panel/dist at or above the patcher exe's directory."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-resolve the workspace dist path; fall back gracefully\nstring distPath = Path.Combine(executableDir, \"web-panel\", \"dist\");\nif (!Directory.Exists(distPath) && !HasEmbeddedRemotePanelResources())\n    throw new InvalidOperationException(\"web-panel/dist not found and no embedded resources; run `cd web-panel && pnpm run build`.\");","typeGuard":null,"tryCatchPattern":"try { enhancer.Patch(); }\ncatch (FileNotFoundException ex) when (ex.Message.Contains(\"Required workspace artifact\")) {\n    // instruct user to build web-panel or run from repo root\n}","preventionTips":["Always embed remote-panel/dist in release builds so FindWorkspacePath is never needed.","Document that dev runs must execute from the repo root.","Add a preflight check that either embedded resources or workspace dist exist."],"tags":["workspace","build","embedded-resources","web-panel"],"backgroundTag":null,"analyzedSha":"643c8f8b62cbb26fd3ac105b92497d9a9c445f08","analyzedAt":"2026-08-13T14:17:43.823Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}