k1tbyte/Wand-Enhancer · critical · FileNotFoundException
Embedded resource not found: {resourceName}
Error message
Embedded resource not found: {resourceName} What it means
Inside CopyEmbeddedDirectory, a name returned by assembly.GetManifestResourceNames() (and already filtered by resourcePrefix) was iterated, but a follow-up GetManifestResourceStream(resourceName) returned null. Under normal .NET behavior a name from the same enumeration always yields a stream, so this signals a corrupt/inconsistent assembly load or a resource-name/prefix collision.
Source
Thrown at WandEnhancer/Core/Enhancer.cs:331
{
return 0;
}
Directory.CreateDirectory(destinationDir);
foreach (var resourceName in resourceNames)
{
var relativePath = resourceName.Substring(resourcePrefix.Length)
.Replace('/', Path.DirectorySeparatorChar)
.Replace('\\', Path.DirectorySeparatorChar);
var destinationPath = Path.Combine(destinationDir, relativePath);
Directory.CreateDirectory(Path.GetDirectoryName(destinationPath) ?? destinationDir);
using (var resource = assembly.GetManifestResourceStream(resourceName))
{
if (resource == null)
{
throw new FileNotFoundException($"Embedded resource not found: {resourceName}");
}
using (var output = File.Create(destinationPath))
{
resource.CopyTo(output);
}
}
}
return resourceNames.Count;
}
private static string FindLocalCustomScriptsPath()
{
string executableDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (string.IsNullOrEmpty(executableDirectory))
{
return null;View on GitHub (pinned to 643c8f8b62)
Solutions
- Rebuild the assembly cleanly (resources may be mis-linked in the .csproj).
- Inspect assembly.GetManifestResourceNames() output (ildasm / a scratch reflection probe) and confirm the resourcePrefix matches the real dotted names.
- If loading via Assembly.Load(byte[]), ensure the load path preserves manifest resources.
- Treat as a fatal build defect — do not suppress; the embedded remote panel is required.
Defensive patterns
Strategy: try-catch
Validate before calling
// Smoke-test resource access at startup
var names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
foreach (var n in names.Where(n => n.StartsWith("remote-panel/dist/")))
if (Assembly.GetExecutingAssembly().GetManifestResourceStream(n) == null)
throw new InvalidOperationException("Corrupt resource: " + n); Try / catch
try { enhancer.Patch(); }
catch (FileNotFoundException ex) when (ex.Message.Contains("Embedded resource not found")) {
// rebuild assembly; this indicates a broken .csproj resource link
} Prevention
- Add a unit test that opens every GetManifestResourceNames() stream.
- Do not load the patcher assembly from compressed/packed sources.
- Keep resource prefixes stable in the .csproj LogicalName settings.
When it happens
Trigger: CopyEmbeddedDirectory loop at Enhancer.cs:327-332: resource came from GetManifestResourceNames() but assembly.GetManifestResourceStream(resourceName) == null.
Common situations: Assembly loaded from a byte array or compressed/packed context where resource stream access differs from name enumeration; a tampered or partially-linked DLL; a rare multi-prefix collision where the prefix filter admits a name from a different resource root.
Related errors
- Required workspace artifact not found: {Path.Combine(segment
- [ENHANCER] Proxy DLL resource not found
- [ENHANCER] Remote bridge artifact is missing. Run `cd web-pa
- [ENHANCER] Remote renderer script artifacts are missing. Run
AI-assisted analysis of k1tbyte/Wand-Enhancer@643c8f8b62 (2026-08-13).
Data as JSON: /api/errors/1fa8f842c078f70d.
Report an issue: GitHub.