go-delve/delve · error

%s has no member %s

Error message

%s has no member %s

What it means

Returned by the member-access logic (find member / struct member selection) in eval.go. When the variable is a loaded fake-address value (e.g. the result of a literal or a loaded composite whose members are pre-populated Children), Delve searches v.Children for a field with the requested name. If none matches, it reports '<varname> has no member <name>'.

Source

Thrown at pkg/proc/eval.go:3023

	return r, nil
}

// findStructMemberOrMethod finds struct member or method name in the type of variable v
func (v *Variable) findStructMemberOrMethod(name string, includeStructMember bool) (*Variable, error) {
	if v.Unreadable != nil {
		return v.clone(), nil
	}
	vname := v.Name
	if v.Name == "" {
		vname = v.DwarfType.String()
	}
	if v.loaded && (v.Flags&VariableFakeAddress) != 0 {
		for i := range v.Children {
			if v.Children[i].Name == name {
				return &v.Children[i], nil
			}
		}
		return nil, fmt.Errorf("%s has no member %s", vname, name)
	}
	closure := false
	switch v.Kind {
	case reflect.Chan:
		v = v.clone()
		v.RealType = godwarf.ResolveTypedef(&(v.RealType.(*godwarf.ChanType).TypedefType))
	case reflect.Interface:
		v.loadInterface(0, false, LoadConfig{})
		if len(v.Children) > 0 {
			v = &v.Children[0]
		}
	case reflect.Func:
		fn := v.bi.PCToFunc(v.Base)
		v.loadFunctionPtr(0, LoadConfig{MaxVariableRecurse: -1})
		if v.Unreadable != nil {
			cst := fn.extra(v.bi).closureStructType
			if cst == nil || cst.ByteSize == 0 {
				// Not a closure, normal function

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Print the value (print expr) to list its actual fields and verify the exact member name
  2. Fix the typo / use the correct field name per the current source version
  3. Confirm the expression type is the struct you intend (whatis expr)
  4. If the field exists in source but not at runtime, rebuild the binary so DWARF matches the sources

Example fix

// before
print(myPoint.Xcoord)      // no such member
// after
print(myPoint.X)           // matches actual field name
Defensive patterns

Strategy: validation

Validate before calling

// list actual members first:
print(expr)   // shows available fields
whatis expr   // confirms the struct type

Type guard

// only access .field after confirming it exists in the printed member list

Prevention

When it happens

Trigger: Evaluating expr.fieldName where expr is a fake-address/loaded variable (VariableFakeAddress flag set) and no child has that Name — e.g. typo'd field names on struct literals constructed in expressions, or accessing fields on values that don't have them.

Common situations: Typos in field names in watch expressions; accessing a field on the wrong struct type; using a field that exists only in a different struct version; trying to access members of non-struct values built as literals in conditions.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/f3c01aec08be262b. Report an issue: GitHub.