{"record":{"id":"6b4bfa5a3dd93dea","repo":"stride3d/stride","slug":"unable-to-find-shader-type","errorCode":null,"errorMessage":"Unable to find shader [{type}]","messagePattern":"Unable to find shader \\[(.+?)\\]","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/ShaderSourceManager.cs","lineNumber":220,"sourceCode":"                                    {\n                                        sourceStream.Position = 0;\n                                        var data = new byte[sourceStream.Length];\n                                        sourceStream.ReadExactly(data, 0, (int)sourceStream.Length);\n                                        shaderSource.Hash = ObjectId.FromBytes(data);\n                                    }\n                                    else\n                                    {\n                                        shaderSource.Hash = databaseStream.ObjectId;\n                                    }\n                                }\n                            }\n                        }\n\n                        loadedShaderSources[type] = shaderSource;\n                    }\n                    else\n                    {\n                        throw new FileNotFoundException($\"Unable to find shader [{type}]\", $\"{type}.sdsl\");\n                    }\n                }\n                return shaderSource;\n            }\n        }\n\n        private static ObjectId CalculateHashFromSource(string source)\n        {\n            return ObjectId.FromBytes(Encoding.UTF8.GetBytes(source));\n        }\n\n        /// <summary>\n        /// Determines whether a class with the specified type name exists.\n        /// </summary>\n        /// <param name=\"typeName\">The typeName.</param>\n        /// <returns><c>true</c> if a class with the specified type name exists; otherwise, <c>false</c>.</returns>\n        public bool IsClassExists(string typeName)\n        {","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/ShaderSourceManager.cs#L202-L238","documentation":"ShaderSourceManager.LoadShaderSource looks up a shader source by type/name among the registered shader sources; when the source is absent after all lookup attempts it throws FileNotFoundException with \"Unable to find shader [{type}]\" and the suggested file name \"{type}.sdsl\". Raised from GetShaderSourceHash's call chain when a shader's source text is needed (e.g. to compute its source hash) but no registered provider contains it.","triggerScenarios":"Calling LoadShaderSource(type) (directly or via GetShaderSourceHash) for a shader name that has not been added to loadedShaderSources / registered sources and cannot be found on the shader lookup path; FileNotFound carries the candidate file name {type}.sdsl.","commonSituations":"Hash lookup for a shader compiled from memory/external buffer that was never registered in the source manager; renamed shader; shader source assembly not referenced.","solutions":["Ensure the shader source is registered with ShaderSourceManager (add source/register assembly) before asking for its hash.","Verify the shader type name string exactly matches the .sdsl file name.","If the shader comes from an external buffer, load it through the path that populates Sources/loadedShaderSources first.","Confirm the .sdsl file exists in a searched location and the candidate name in the exception is correct."],"exampleFix":"// before\nvar hash = sourceManager.GetShaderSourceHash(\"MissingShader\"); // FileNotFoundException\n// after\nif (!sourceManager.HasShaderSource(\"MissingShader\"))\n    sourceManager.AddOrReplaceShaderSource(\"MissingShader\", sdslText);\nvar hash = sourceManager.GetShaderSourceHash(\"MissingShader\");","handlingStrategy":"validation","validationCode":"// guard before asking for a hash\nif (!sourceManager.HasShaderSource(type) && !File.Exists(Path.Combine(shaderDir, type + \".sdsl\")))\n    throw new FileNotFoundException($\"Register or ship shader source: {type}.sdsl\");","typeGuard":null,"tryCatchPattern":"try { var hash = sourceManager.GetShaderSourceHash(type); }\ncatch (FileNotFoundException ex) when (ex.FileName == type + \".sdsl\") {\n    RegisterShaderSource(type, sdslText); // then retry once\n}","preventionTips":["Register shader sources/assemblies with ShaderSourceManager at startup.","For external/memory-loaded shaders, populate Sources before hash lookups.","Keep shader type names in sync with .sdsl file names via build-time checks."],"tags":["shader","file-not-found","shader-source"],"backgroundTag":"file-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}