{"record":{"id":"7d79991dd40920de","repo":"stride3d/stride","slug":"member-name-was-not-found-in-shader-shadername","errorCode":null,"errorMessage":"Member {name} was not found in shader {ShaderName}","messagePattern":"Member (.+?) was not found in shader (.+?)","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.ShaderInfo.cs","lineNumber":55,"sourceCode":"        public int EndInstruction { get; internal set; } = endInstruction;\n        public Dictionary<string, List<(int Id, FunctionType Type)>> Functions { get; } = new();\n        public Dictionary<string, (int Id, SymbolType Type)> Variables { get; } = new();\n\n        public Dictionary<string, int> StructTypes { get; } = new();\n\n        public (int Id, SymbolType Type) FindMember(string name, FunctionType? functionType = null)\n        {\n            if (Functions.TryGetValue(name, out var functions))\n            {\n                foreach (var function in functions)\n                {\n                    if (function.Type == functionType)\n                        return (function.Id, function.Type);\n                }\n            }\n            if (Variables.TryGetValue(name, out var variable))\n                return (variable.Id, variable.Type);\n            throw new KeyNotFoundException($\"Member {name} was not found in shader {ShaderName}\");\n        }\n\n        public override string ToString() => $\"{ShaderName} ({(CompositionPath != null ? $\" {CompositionPath} \" : \"\")}{StartInstruction}..{EndInstruction})\";\n    }\n\n    private void PopulateShaderInfo(MixinGlobalContext globalContext, SpirvContext context, int contextStart, int contextEnd, SpirvBuffer buffer, int shaderStart, int shaderEnd, ShaderInfo shaderInfo, MixinNode mixinNode)\n    {\n        var removedIds = new HashSet<int>();\n        for (var index = shaderStart; index < shaderEnd; index++)\n        {\n            var i = buffer[index];\n\n            if (i.Data.Op == Op.OpFunction && (OpFunction)i is { } function)\n            {\n                var functionName = context.Names[function.ResultId];\n                var functionType = (FunctionType)context.ReverseTypes[function.FunctionType];\n                if (!shaderInfo!.Functions.TryGetValue(functionName, out var functions))\n                    shaderInfo.Functions.Add(functionName, functions = new());","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.ShaderInfo.cs#L37-L73","documentation":"ShaderInfo.FindMember resolves a member name (function or variable) within a merged shader's SPIR-V info. When neither the functions nor the variables dictionaries contain the name, it throws KeyNotFoundException identifying the shader. This indicates the referenced symbol was not imported/duplicated into this shader's range during mixing.","triggerScenarios":"Looking up a member by name that the shader never declares; referencing a member declared only in another mixin without proper composition/inheritance; name mismatches after renaming; querying ShaderInfo for symbols stripped because they were stage-only and not imported.","commonSituations":"Calling a base-class method that the composed shader didn't inherit; typos in member names in compose/inherit directives; accessing a variable from a shader whose stage composition failed.","solutions":["Verify the member name spelling against the declaring shader source","Ensure the shader declaring the member is actually mixed in (compose/inherit) for this node","Check that the member isn't stage-only when not at the root mixin (see MergeClassInBuffers)","Inspect ShaderInfo.Variables/Functions dictionaries for available names"],"exampleFix":"// before: member not mixed in\nvar shader = mixer.MergeSDSL(tree, ...); // 'ComputeIt' lives in a shader not composed here\nvar (id, type) = shaderInfo.FindMember(\"ComputeIt\");\n// after: add the composition supplying the shader that declares ComputeIt\nmixinTree[\"ComputeIt\"] = loadShader(\"MyComputeShader\");","handlingStrategy":"try-catch","validationCode":"if (!shaderInfo.Variables.ContainsKey(memberName) && !shaderInfo.Functions.ContainsKey(memberName))\n    throw new ArgumentException($\"{memberName} not present in {shaderInfo.ShaderName}\");","typeGuard":"bool HasMember(ShaderInfo info, string name) =>\n    info.Variables.ContainsKey(name) || info.Functions.ContainsKey(name);","tryCatchPattern":"try { var (id, type) = shaderInfo.FindMember(name); }\ncatch (KeyNotFoundException ex) when (ex.Message.Contains(\"was not found in shader\")) {\n    logMissingMixinMember(name, shaderInfo.ShaderName);\n}","preventionTips":["Confirm the declaring shader is mixed into the node before lookups","Check spelling against source SDSL","Inspect ShaderInfo.Variables/Functions when unsure of available members"],"tags":["shaders","sdsl","symbol-lookup","spirv"],"backgroundTag":"record-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"}