{"record":{"id":"d00225128d893f5d","repo":"go-delve/delve","slug":"unable-to-set-breakpoint","errorCode":null,"errorMessage":"unable to set breakpoint","messagePattern":"unable to set breakpoint","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"service/dap/server.go","lineNumber":1824,"sourceCode":"func setLogMessage(bp *api.Breakpoint, msg string) error {\n\ttracepoint, userdata, err := parseLogPoint(msg)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbp.Tracepoint = tracepoint\n\tif userdata != nil {\n\t\tbp.UserData = *userdata\n\t}\n\treturn nil\n}\n\nfunc (s *Session) updateBreakpointsResponse(breakpoints []dap.Breakpoint, i int, err error, got *api.Breakpoint) {\n\t// TODO(@Lslightly): For DAP v1.68.0, Reason can be set to \"pending\" when a\n\t// breakpoint is suspended. But it seems that nothing different happens.\n\n\t// Is the breakpoint suspended?\n\tif err == nil && len(got.Addrs) == 0 {\n\t\terr = errors.New(\"unable to set breakpoint\")\n\t}\n\n\tbreakpoints[i].Verified = err == nil\n\tif err != nil {\n\t\tbreakpoints[i].Message = err.Error()\n\t}\n\n\t// If the error is connected to a specific breakpoint, tell the user.\n\tif got != nil {\n\t\tbreakpoints[i].Id = got.ID\n\t}\n\n\t// If we have a file path, update the breakpoint.\n\tif got != nil && got.File != \"\" {\n\t\tpath := s.toClientPath(got.File)\n\t\tbreakpoints[i].Line = got.Line\n\t\tbreakpoints[i].Source = &dap.Source{Name: filepath.Base(path), Path: path}\n\t}","sourceCodeStart":1806,"sourceCodeEnd":1842,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/dap/server.go#L1806-L1842","documentation":"updateBreakpointsResponse marks a breakpoint unverified when, even though no error occurred during creation, the resulting api.Breakpoint has no addresses (len(got.Addrs) == 0). Since a breakpoint that bound to no code address is useless, it synthesizes 'unable to set breakpoint' and reports it in the DAP Breakpoint.message with Verified=false.","triggerScenarios":"Setting a breakpoint on a line with no executable code (comments, declarations, blank lines, non-optimized-out lines); breakpoint in a file not covered by compiled Go code; a location that resolves syntactically but maps to zero program addresses.","commonSituations":"Users clicking the gutter on struct/func declaration lines or import blocks; breakpoints in files whose build differs from the running binary; breakpoints in generated code that was never compiled; stale binaries lacking debug info for the file.","solutions":["Move the breakpoint to a line containing executable statements","Rebuild the target with full debug info (-gcflags=all='-N -l' for dev builds) and ensure the binary matches the sources","Use delve CLI (dlv) to verify the location resolves (break main.go:LINE) before using it in the IDE","Check substitutePath/remote path mapping so the source file maps to compiled code"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-check the line has executable code before setting a breakpoint\n// e.g. in the client, only offer breakpoints on statement lines from the editor's\n// declaration/statement provider, or verify via dlv: break main.go:LINE","typeGuard":null,"tryCatchPattern":"// treat unverified breakpoints as warnings, not failures\nif !bp.Verified { log.Printf(\"bp not bound: %s\", bp.Message) }","preventionTips":["Set breakpoints on lines with executable statements only","Keep the binary rebuilt with matching sources and debug info","Verify path mappings (substitutePath) in remote setups"],"tags":["dap","breakpoints","debug-info","go"],"backgroundTag":"breakpoint-not-verified","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}