{"record":{"id":"56fa95991d16da87","repo":"go-delve/delve","slug":"unable-to-find-locals-no-debug-information-presen","errorCode":null,"errorMessage":"unable to find locals: no debug information present in binary","messagePattern":"unable to find locals: no debug information present in binary","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/eval.go","lineNumber":425,"sourceCode":"\tif len(scope.rangeFrames) > 0 {\n\t\tscope.rangeFrames = scope.rangeFrames[2:] // skip the first frame and its return frame\n\t}\n\tscope.enclosingRangeScopes = make([]*EvalScope, len(scope.rangeFrames)/2)\n\treturn nil\n}\n\n// simpleLocals returns all local variables in 'scope'.\n// This function does not try to merge the scopes of range-over-func closure\n// bodies with their enclosing function, for that use (*EvalScope).Locals or\n// (*EvalScope).FindLocal instead.\n// If wantedName is specified only variables called wantedName or \"&\"+wantedName are returned.\nfunc (scope *EvalScope) simpleLocals(flags localsFlags, wantedName string) ([]*Variable, error) {\n\tif scope.Fn == nil {\n\t\treturn nil, errors.New(\"unable to find function context\")\n\t}\n\n\tif scope.image().Stripped() {\n\t\treturn nil, errors.New(\"unable to find locals: no debug information present in binary\")\n\t}\n\n\ttrustArgOrder := (flags&localsTrustArgOrder != 0) && scope.BinInfo.Producer() != \"\" && goversion.ProducerAfterOrEqual(scope.BinInfo.Producer(), 1, 12) && scope.Fn != nil && (scope.PC == scope.Fn.Entry)\n\n\tdwarfTree, err := scope.image().getDwarfTree(scope.Fn.offset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvariablesFlags := reader.VariablesOnlyVisible | reader.VariablesSkipInlinedSubroutines\n\tif flags&localsNoDeclLineCheck != 0 {\n\t\tvariablesFlags = reader.VariablesNoDeclLineCheck\n\t}\n\tif scope.BinInfo.Producer() != \"\" && goversion.ProducerAfterOrEqual(scope.BinInfo.Producer(), 1, 15) {\n\t\tvariablesFlags |= reader.VariablesTrustDeclLine\n\t}\n\n\tvarEntries := reader.Variables(dwarfTree, scope.PC, scope.Line, variablesFlags)","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/eval.go#L407-L443","documentation":"simpleLocals refuses to enumerate locals when the binary image backing the scope has no DWARF debug info (image().Stripped()). Without debug info there are no variable DIEs to decode, so delve explicitly reports the binary is stripped rather than returning an empty list.","triggerScenarios":"Calling Locals() (or FindLocal) while debugging a binary built with -ldflags \"-s -w\" or otherwise stripped of .debug_* sections; attaching to a release-build process; core dump of a stripped binary.","commonSituations":"Debugging production/CI builds that strip symbols; go build with -trimpath plus -s -w; attaching to vendor-shipped Go binaries; mixed builds where the main module is stripped but dependencies are not.","solutions":["Rebuild the binary with debug info: go build without -s and -w linker flags (e.g. go build -gcflags=\"all=-N -l\").","Verify with `go tool nm <binary>` or `file <binary>` ('not stripped') that DWARF sections exist before debugging.","If the binary cannot be rebuilt, debug a non-stipped copy of the same commit (addresses match when build flags otherwise identical).","Check BinInfo.Producer()/image().Stripped() upfront in tooling and warn users instead of failing mid-session."],"exampleFix":"// before\n$ go build -ldflags=\"-s -w\" -o app .\n$ dlv exec app\n// after\n$ go build -gcflags=\"all=-N -l\" -o app .\n$ dlv exec app","handlingStrategy":"validation","validationCode":"if scope.BinInfo == nil || scope.image().Stripped() {\n    return fmt.Errorf(\"binary is stripped; rebuild without -s -w\")\n}","typeGuard":"func debugInfoAvailable(scope *proc.EvalScope) bool {\n    return scope != nil && scope.Fn != nil && !scope.image().Stripped()\n}","tryCatchPattern":"vars, err := scope.Locals(0)\nif err != nil && strings.Contains(err.Error(), \"no debug information\") {\n    return fmt.Errorf(\"rebuild the binary with debug info: go build (no -s -w)\")\n}","preventionTips":["Build debug binaries with -gcflags=\"all=-N -l\" and no -s -w linker flags","Check `file <binary>` reports 'not stripped' before debugging sessions","Keep a non-stripped build of the same commit for production core dumps","Warn users early when BinInfo indicates a stripped image"],"tags":["go","debugger","stripped-binary","dwarf"],"backgroundTag":"stripped-binary-no-debug-info","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}