{"record":{"id":"4f57061d80f81964","repo":"go-delve/delve","slug":"could-not-determine-current-location","errorCode":null,"errorMessage":"could not determine current location","messagePattern":"could not determine current location","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/locspec/locations.go","lineNumber":639,"sourceCode":"\t}\n\treturn api.Location{PC: addrs[0], PCs: addrs}\n}\n\n// Find returns the location after adding the offset amount to the current line number.\nfunc (loc *OffsetLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, _ string, includeNonExecutableLines bool, _ [][2]string) ([]api.Location, string, error) {\n\tif scope == nil {\n\t\treturn nil, \"\", errors.New(\"could not determine current location (scope is nil)\")\n\t}\n\tfile, line, fn := scope.BinInfo.PCToLine(scope.PC)\n\tif loc.Offset == 0 {\n\t\tsubst := \"\"\n\t\tif fn != nil {\n\t\t\tsubst = fmt.Sprintf(\"%s:%d\", file, line)\n\t\t}\n\t\treturn []api.Location{{PC: scope.PC}}, subst, nil\n\t}\n\tif fn == nil {\n\t\treturn nil, \"\", errors.New(\"could not determine current location\")\n\t}\n\tsubst := fmt.Sprintf(\"%s:%d\", file, line+loc.Offset)\n\taddrs, err := proc.FindFileLocation(t, file, line+loc.Offset)\n\tif includeNonExecutableLines {\n\t\tif _, isCouldNotFindLine := err.(*proc.ErrCouldNotFindLine); isCouldNotFindLine {\n\t\t\treturn []api.Location{{File: file, Line: line + loc.Offset}}, subst, nil\n\t\t}\n\t}\n\treturn []api.Location{addressesToLocation(addrs)}, subst, err\n}\n\n// Find will return the location at the given line in the current file.\nfunc (loc *LineLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, _ string, includeNonExecutableLines bool, _ [][2]string) ([]api.Location, string, error) {\n\tif scope == nil {\n\t\treturn nil, \"\", errors.New(\"could not determine current location (scope is nil)\")\n\t}\n\tfile, _, fn := scope.BinInfo.PCToLine(scope.PC)\n\tif fn == nil {","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/locspec/locations.go#L621-L657","documentation":"OffsetLocationSpec.Find maps scope.PC to file/line via PCToLine; if that returns a nil function (the PC is not attributable to any known function), Delve cannot determine the current location to apply the offset to and returns this error.","triggerScenarios":"Calling Find with a non-nil scope whose PC lies outside known code — e.g. in runtime/asm code, cgo frames, or addresses with no line-table entry.","commonSituations":"Stepping into assembly or runtime frames and then trying b +N; using offset breakpoints when stopped at a PC in a file without debug line info.","solutions":["Move to a frame inside your own Go code (frame up/down) before using relative breakpoints","Use an absolute file:line breakpoint instead of a line offset","Ensure the binary was built with debug info (no -w -s) so PCToLine can resolve the PC"],"exampleFix":"// before\n// stopped in runtime.asmcgocall\ndlv> b +2\n// after\ndlv> frame up\ndlv> b +2  // or: b main.go:42","handlingStrategy":"validation","validationCode":"file, _, fn := scope.BinInfo.PCToLine(scope.PC)\nif fn == nil {\n    return errors.New(\"current PC has no line info; use an absolute file:line breakpoint\")\n}\nlocs, subst, err := loc.Find(t, funcs, scope, locStr, false, nil)","typeGuard":null,"tryCatchPattern":"locs, _, err := loc.Find(t, funcs, scope, \"+2\", false, nil)\nif err != nil && strings.Contains(err.Error(), \"could not determine current location\") {\n    return fmt.Errorf(\"move to a Go frame or use file:line: %w\", err)\n}","preventionTips":["Avoid +N breakpoints while in runtime/assembly/cgo frames","Build targets with full DWARF info (-gcflags=all=-N -l for dev builds)","Switch frames (up/down) before relative breakpoints"],"tags":["breakpoints","debug-info"],"backgroundTag":"no-line-info-for-pc","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}