{"record":{"id":"724d7cce8d035aa2","repo":"go-delve/delve","slug":"s-type-s-has-no-member-s","errorCode":null,"errorMessage":"%s (type %s) has no member %s","messagePattern":"(.+?) \\(type (.+?)\\) has no member (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/eval.go","lineNumber":3148,"sourceCode":"\t\t\t\t}\n\t\t\t\t// Check for embedded field referenced by type name\n\t\t\t\tparts := strings.Split(field.Name, \".\")\n\t\t\t\tif includeStructMember && len(parts) > 1 && parts[1] == name {\n\t\t\t\t\treturn embeddedVar, nil\n\t\t\t\t}\n\t\t\t\tembeddedVar.Name = structVar.Name\n\t\t\t\tqueue = append(queue, embeddedVar)\n\t\t\t}\n\t\tcase *godwarf.InterfaceType:\n\t\t\tv.loadInterface(0, false, LoadConfig{})\n\t\t\tif len(v.Children) > 0 {\n\t\t\t\tif rv, _ := v.Children[0].findStructMemberOrMethod(name, false); rv != nil {\n\t\t\t\t\treturn rv, nil\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\tif first {\n\t\t\t\treturn nil, fmt.Errorf(\"%s (type %s) has no member %s\", vname, structVar.TypeString(), name)\n\t\t\t}\n\t\t}\n\t\tfirst = false\n\t}\n\n\treturn nil, fmt.Errorf(\"%s has no member %s\", vname, name)\n}\n\nfunc lookupMethod(v *Variable, isptr bool, pkg, receiver, name string) (*Variable, error) {\n\tchecks := []struct {\n\t\tfmt     string\n\t\tptrRecv bool\n\t}{\n\t\t{\"%s.(*%s).%s\", true},\n\t\t{\"%s.%s.%s\", false},\n\t}\n\tif !isptr {\n\t\tchecks[0], checks[1] = checks[1], checks[0]","sourceCodeStart":3130,"sourceCodeEnd":3166,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/eval.go#L3130-L3166","documentation":"This error is thrown by Delve's expression evaluator (pkg/proc/eval.go) when you evaluate a member access like `v.Field` or `v.Method()` on a struct value, and the resolved struct type has no field or method with that name, even after searching promoted/embedded members and methods (including pointer-receiver methods). It is the evaluator's way of reporting a name-resolution failure on struct member lookup.","triggerScenarios":"Evaluating an expression in the debugger (print/display, breakpoint condition, watchpoint) that selects a member on a struct/interface-typed variable, where: (1) the field name is misspelled, (2) the field belongs to a different struct, (3) the method is unexported and on a type from another package, or (4) the embedded/promoted path you assume does not exist.","commonSituations":"Typos in field names during interactive debugging; assuming an embedded struct promotes a member it does not; accessing a method on the value (not pointer) type where the method requires a pointer the debugger cannot synthesize; refactoring renamed a field while old breakpoint conditions or watch expressions persist; debugging a binary built from source that no longer matches the type (stale binary).","solutions":["Print the variable itself (e.g. `print v`) or use tab completion to list actual members and correct the name in the expression","Check the struct definition (embedded fields, promoted methods) with `whatis v` and the source to confirm the member exists and its promotion path","If a breakpoint condition or watch expression uses the old name, update or delete it after refactoring","Rebuild/reload the binary so debug info matches the source you are reading"],"exampleFix":"// before (Delve CLI, struct has no field Nam)\n(dlv) print p.Nam\n// error: main.Point (type main.Point) has no member Nam\n// after\n(dlv) print p.Name","handlingStrategy":"validation","validationCode":"// Before relying on member access, confirm the member exists:\n// (dlv) print v            // dumps the struct incl. all fields\n// (dlv) whatis v           // prints the type\n// In Go code driving delve programmatically:\nif _, err := evalExpr(\"v\"); err != nil { return err }\n// only then evaluate \"v.Field\"","typeGuard":"func hasMember(client *rpc2.RPCClient, expr, member string) bool {\n    v, err := client.EvalVariable(expr, ...)\n    if err != nil { return false }\n    for _, ch := range v.Children {\n        if ch.Name == member { return true }\n    }\n    return false\n}","tryCatchPattern":"val, err := evalExpr(\"v.Field\")\nif err != nil && strings.Contains(err.Error(), \"has no member\") {\n    // fall back to printing the whole struct for the user\n    val, err = evalExpr(\"v\")\n}","preventionTips":["Use tab completion in the delve CLI for member names instead of typing them","Run `whatis <expr>` to confirm the static type before selecting members","After refactoring, audit and update all saved breakpoint conditions and watch expressions","Rebuild the target binary whenever source types change"],"tags":["debugger","eval","struct","member-lookup"],"backgroundTag":"no-struct-member","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}