{"record":{"id":"b64acab505d4beab","repo":"stride3d/stride","slug":"can-t-find-method-group-info-for-context-names-functionid","errorCode":null,"errorMessage":"Can't find method group info for {context.Names[functionId]}","messagePattern":"Can't find method group info for (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.cs","lineNumber":1033,"sourceCode":"                }\n                else if (context.ReverseTypes[memberAccess.ResultType] is FunctionType functionType)\n                {\n                    // In case of functions, OpMemberAccessSDSL.Member could either be a OpFunction or a OpImportFunctionSDSL\n                    var functionId = memberAccess.Member;\n                    if (globalContext.ExternalFunctions.TryGetValue(memberAccess.Member, out var function))\n                    {\n                        // Process member call (composition)\n                        if (!instanceMixinGroup.MethodGroupsByName.TryGetValue((function.Name, functionType), out functionId)\n                            && (instanceMixinGroup.Stage == null || !instanceMixinGroup.Stage.MethodGroupsByName.TryGetValue((function.Name, functionType), out functionId)))\n                            throw new InvalidOperationException($\"Can't find function {function.Name} in current mixin\");\n                    }\n\n                    bool foundInStage = false;\n                    if (!instanceMixinGroup.MethodGroups.TryGetValue(functionId, out var methodGroupEntry))\n                    {\n                        // Try again as a stage method (only if not a base call)\n                        if (instanceMixinGroup.Stage == null || !instanceMixinGroup.Stage.MethodGroups.TryGetValue(functionId, out methodGroupEntry))\n                            throw new InvalidOperationException($\"Can't find method group info for {context.Names[functionId]}\");\n                        foundInStage = true;\n                    }\n\n                    // Default: most derived implementation\n                    var selectedMethod = methodGroupEntry.Methods[^1];\n\n                    // Process base call\n                    if (isBase)\n                    {\n                        // We currently do not allow calling base stage method from a non-stage method\n                        // (if we were to allow them later, we would need to tweak following detection code as ShaderIndex comparison is only valid for items within the same MixinNode)\n                        if (foundInStage)\n                            throw new InvalidOperationException($\"Method {methodGroupEntry.Name} was found but a base call can't be performed on a stage method from a non-stage method\");\n\n                        // Is it a base call? if yes, find the direct parent\n                        // Let's find the method in same group just before ours\n                        bool baseMethodFound = false;\n                        for (int j = methodGroupEntry.Methods.Count - 1; j >= 0; --j)","sourceCodeStart":1015,"sourceCodeEnd":1051,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.cs#L1015-L1051","documentation":"After resolving a function id for a member call, the mixer fetches the method group entry (the list of overriding implementations) from the mixin's MethodGroups. If the id is not present there, it retries in the Stage's MethodGroups. Failure in both means the function id has no method-group metadata, so override selection (most-derived method) cannot proceed.","triggerScenarios":"ShaderMixer constructor: after functionId resolution (direct or via ExternalFunctions), instanceMixinGroup.MethodGroups lacks functionId and (Stage is null or instanceMixinGroup.Stage.MethodGroups lacks it).","commonSituations":"Internal mismatch between the function id produced by earlier mixing passes and method groups registered for the shader; function declared in ExternalFunctions but never registered as a method group; stage composition missing where the method group lives.","solutions":["Ensure the shader defining the function is part of the mixin composition so its method group is registered.","Attach the Stage if the method group is registered at stage level.","Rebuild shader caches if ids came from stale compiled data.","Check for signature/overload mismatches that make the resolved id point to no registered group."],"exampleFix":"// before: method defined only in a shader never composed\n// after: compose/inherit the shader that defines it\nshader MyShader : BaseShaderWithMethod { /* overrides or uses it */ }","handlingStrategy":"try-catch","validationCode":"// Sanity-check that every resolved function id has method-group metadata before mixing\nforeach (var fnId in resolvedFunctionIds)\n    if (!instanceMixinGroup.MethodGroups.ContainsKey(fnId) &&\n        !(instanceMixinGroup.Stage?.MethodGroups.ContainsKey(fnId) ?? false))\n        throw new InvalidOperationException($\"Function id {fnId} has no method group; rebuild shaders\");","typeGuard":null,"tryCatchPattern":"try { var mixed = mixer.Process(...); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Can't find method group info\"))\n{\n    log.Error(ex, \"Method group metadata missing; rebuild shader caches and verify composition includes the defining shader\");\n    throw;\n}","preventionTips":["Always rebuild shaders from clean sources after upgrading Stride or changing SDSL files.","Ensure the shader defining each function is part of the mixin composition.","Never mix hand-edited or partially regenerated compiled shader data.","Treat reproducible failures on clean sources as mixer bugs and file them with repro sources."],"tags":["shader","sdsl","method-group","internal-state"],"backgroundTag":"internal-invariant-violation","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"}