{"record":{"id":"7ca9655db9db6d95","repo":"microsoft/semantic-kernel","slug":"s-namespace-name-resource-not-found","errorCode":null,"errorMessage":"[{s_namespace}] {name} resource not found","messagePattern":"\\[(.+?)\\] (.+?) resource not found","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Orchestration.Flow/EmbeddedResource.cs","lineNumber":25,"sourceCode":"\ninternal static class EmbeddedResource\n{\n    private static readonly string? s_namespace = typeof(EmbeddedResource).Namespace;\n\n    internal static string? Read(string name, bool throwIfNotFound = true)\n    {\n        var assembly = typeof(EmbeddedResource).GetTypeInfo().Assembly ??\n            throw new KernelException($\"[{s_namespace}] {name} assembly not found\");\n\n        using Stream? resource = assembly.GetManifestResourceStream($\"{s_namespace}.\" + name);\n        if (resource is null)\n        {\n            if (!throwIfNotFound)\n            {\n                return null;\n            }\n\n            throw new KernelException($\"[{s_namespace}] {name} resource not found\");\n        }\n\n        using var reader = new StreamReader(resource);\n        return reader.ReadToEnd();\n    }\n}\n","sourceCodeStart":7,"sourceCodeEnd":32,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Orchestration.Flow/EmbeddedResource.cs#L7-L32","documentation":"EmbeddedResource.Read constructs a resource name as '{namespace}.{name}' and calls GetManifestResourceStream. If no embedded resource matches that fully-qualified name, the stream is null. When throwIfNotFound is true (the default), KernelException is thrown listing the namespace and requested resource name.","triggerScenarios":"Calling EmbeddedResource.Read with a resource name that doesn't match any file embedded in the Orchestration.Flow assembly. The name must exactly match (including the namespace prefix that the method adds automatically).","commonSituations":"The .resourcemp or prompt file was renamed or removed from the project but code still references the old name. The file's Build Action is not 'Embedded Resource' so it isn't packaged. A typo in the resource name passed to Read(). Namespace changes after refactoring that break the prefixed name.","solutions":["Verify the resource file exists in the project and its Build Action is set to 'Embedded Resource'.","Check the exact manifest resource name using Assembly.GetManifestResourceNames() to see what is actually embedded.","Ensure the name passed to Read() matches the filename (without namespace prefix — the method adds it) exactly, including case.","After renaming or moving resource files, rebuild to regenerate the manifest."],"exampleFix":"// before — resource name doesn't match embedded file\nvar content = EmbeddedResource.Read(\"Prompts/OldPrompt.config\");\n\n// after — match the actual embedded resource name\n// Check: typeof(EmbeddedResource).Assembly.GetManifestResourceNames()\nvar content = EmbeddedResource.Read(\"Prompts/NewPrompt.config\");","handlingStrategy":"validation","validationCode":"// Verify the resource exists before reading\nvar assembly = typeof(EmbeddedResource).GetTypeInfo().Assembly;\nvar fullName = $\"{typeof(EmbeddedResource).Namespace}.{resourceName}\";\nif (assembly.GetManifestResourceNames().All(n => n != fullName))\n{\n    throw new FileNotFoundException(\n        $\"Embedded resource '{fullName}' not found. Available: {string.Join(\", \", assembly.GetManifestResourceNames())}\");\n}","typeGuard":null,"tryCatchPattern":"try { var content = EmbeddedResource.Read(resourceName); }\ncatch (KernelException ex) when (ex.Message.Contains(\"resource not found\"))\n{\n    var available = typeof(EmbeddedResource).Assembly.GetManifestResourceNames();\n    logger.LogError(\"Resource '{Name}' not found. Embedded: {Names}\", resourceName, string.Join(\", \", available));\n    throw;\n}","preventionTips":["Set Build Action to 'Embedded Resource' for all prompt/config files in the project.","Run unit tests that load every embedded resource at build time to catch missing files early.","After renaming resource files, update all code references and rebuild."],"tags":["embedded-resource","manifest","build","experimental"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}