go-delve/delve · warning
unable to set breakpoint
Error message
unable to set breakpoint
What it means
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.
Source
Thrown at service/dap/server.go:1824
func setLogMessage(bp *api.Breakpoint, msg string) error {
tracepoint, userdata, err := parseLogPoint(msg)
if err != nil {
return err
}
bp.Tracepoint = tracepoint
if userdata != nil {
bp.UserData = *userdata
}
return nil
}
func (s *Session) updateBreakpointsResponse(breakpoints []dap.Breakpoint, i int, err error, got *api.Breakpoint) {
// TODO(@Lslightly): For DAP v1.68.0, Reason can be set to "pending" when a
// breakpoint is suspended. But it seems that nothing different happens.
// Is the breakpoint suspended?
if err == nil && len(got.Addrs) == 0 {
err = errors.New("unable to set breakpoint")
}
breakpoints[i].Verified = err == nil
if err != nil {
breakpoints[i].Message = err.Error()
}
// If the error is connected to a specific breakpoint, tell the user.
if got != nil {
breakpoints[i].Id = got.ID
}
// If we have a file path, update the breakpoint.
if got != nil && got.File != "" {
path := s.toClientPath(got.File)
breakpoints[i].Line = got.Line
breakpoints[i].Source = &dap.Source{Name: filepath.Base(path), Path: path}
}View on GitHub (pinned to a23773e6c3)
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
Defensive patterns
Strategy: validation
Validate before calling
// pre-check the line has executable code before setting a breakpoint // e.g. in the client, only offer breakpoints on statement lines from the editor's // declaration/statement provider, or verify via dlv: break main.go:LINE
Try / catch
// treat unverified breakpoints as warnings, not failures
if !bp.Verified { log.Printf("bp not bound: %s", bp.Message) } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- breakpoint already exists
- breakpoint names that are relative paths are not supported
- call stopped
- could not determine current location
- cannot write a breakpoint to a core file
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/d00225128d893f5d.
Report an issue: GitHub.