stride3d/stride · error · InvalidOperationException

Member not found

Error message

Member {memberAccess.Member} not found

What it means

The mixer resolves OpMemberAccess instructions to variables, functions, or method groups. If the member name is not found in globalContext.ExternalVariables or globalContext.ExternalFunctions (i.e. it is neither a known external variable nor a known external function), there is no way to bind the member access and mixing fails.

Solutions

  1. Declare the member as an external variable or function in the shader that owns it.
  2. Correct the member name at the access site.
  3. Verify the shader declaring the member is included in globalContext (ExternalShaders/composition).
  4. Recompile shaders so the external symbol tables are regenerated.

Example fix

// before: accessing undeclared member
var v = SomeMember;
// after: declare it in the owning shader
extern float4 SomeMember; // then access via proper composition
Defensive patterns

Strategy: validation

Validate before calling

// Only access members registered as external variables or functions
bool memberKnown = globalContext.ExternalVariables.ContainsKey(memberName)
    || globalContext.ExternalFunctions.ContainsKey(memberName);
if (!memberKnown)
    throw new InvalidOperationException($"Member '{memberName}' must be declared as an external variable or function in a composed shader");

Try / catch

try { var mixed = mixer.Process(...); }
catch (InvalidOperationException ex) when (ex.Message.Contains("Member") && ex.Message.Contains("not found"))
{
    log.Error(ex, "Unresolved member access; declare it extern in the owning shader or fix the name");
    throw;
}

Prevention

When it happens

Trigger: ShaderMixer constructor reaches the final else branch of member-access handling: memberAccess.Member is absent from both globalContext.ExternalVariables and globalContext.ExternalFunctions.

Common situations: Accessing a member that was never declared/registered in any shader of the composition; typos in member names; accessing a field of a composed shader that is not exposed as external; stale compiled shader modules after renaming members.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/6adb592d5323328f. Report an issue: GitHub.

Appendix: source

Thrown at sources/shaders/Stride.Shaders.Compilers/SDSL/ShaderMixer.cs:1073

                                selectedMethod = methodGroupEntry.Methods[j];
                                baseMethodFound = true;
                                break;
                            }
                        }

                        if (!baseMethodFound)
                            throw new InvalidOperationException($"Can't find a base method for {methodGroupEntry.Name}");
                    }

                    if ((selectedMethod.Flags & FunctionFlagsMask.Abstract) != 0)
                        throw new InvalidOperationException($"Trying to call an abstract method {selectedMethod.Shader.ShaderName}.{methodGroupEntry.Name}");
                    functionId = selectedMethod.MethodId;

                    memberAccesses.Add(memberAccess.ResultId, functionId);
                }
                else
                {
                    throw new InvalidOperationException($"Member {memberAccess.Member} not found");
                }

                SetOpNop(i.Data.Memory.Span);
            }
            else if (i.Data.Op == Op.OpFunction && (OpFunction)i is { } function && temp[index + 1].Op == Op.OpFunctionMetadataSDSL && (OpFunctionMetadataSDSL)temp[index + 1] is { } functionInfo)
            {
                if (!mixinNode.MethodGroups.TryGetValue(function.ResultId, out var methodGroupEntry))
                    throw new InvalidOperationException($"Can't find method group info for {context.Names[function.ResultId]}");
            }
            else if (i.Data.Op == Op.OpFunctionEnd)
            {
                memberAccesses.Clear();
            }

            SpirvBuilder.RemapIds(memberAccesses, ref i.Data);
        }
    }

View on GitHub (pinned to 96fad776d2)