go-delve/delve · error

error while creating breakpoint: %v, additionally the breakp

Error message

error while creating breakpoint: %v, additionally the breakpoint could not be properly rolled back: %v

What it means

During enableBreakpoint, a target returned an unexpected error (err0) while setting the breakpoint; Delve then tried to roll back by clearing any already-inserted physical breakpoints for the same logical ID, and the rollback itself also failed. This compound error reports both the original creation failure and the failed rollback, meaning breakpoint state may be partially inconsistent.

Source

Thrown at pkg/proc/target_group.go:365

	}
	if errNotFound != nil && !didSet {
		return errNotFound
	}
	if errExists != nil && !didSet {
		return errExists
	}
	if !didSet {
		if _, err := grp.Valid(); err != nil {
			return err
		}
	}
	if err0 != nil {
		it := ValidTargets{Group: grp}
		for it.Next() {
			for _, bp := range it.Breakpoints().M {
				if bp.LogicalID() == lbp.LogicalID {
					if err1 := it.ClearBreakpoint(bp.Addr); err1 != nil {
						return fmt.Errorf("error while creating breakpoint: %v, additionally the breakpoint could not be properly rolled back: %v", err0, err1)
					}
				}
			}
		}
		return err0
	}
	return nil
}

func enableBreakpointOnTarget(p *Target, lbp *LogicalBreakpoint) error {
	if !lbp.enabled || !lbp.condSatisfiable {
		return nil
	}
	var err error
	var addrs []uint64
	switch {
	case lbp.Set.File != "":
		addrs, err = FindFileLocation(p, lbp.Set.File, lbp.Set.Line)

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Fix the root cause in the first '%v' (the original SetBreakpoint error) first — it names the underlying failure
  2. Check the rollback error; if it says breakpoint not found, the state may already be clean
  3. Restart the debug session or detach and reattach to reset breakpoint state
  4. Verify the breakpoint address is in executable, mapped memory in each target
  5. For multi-process groups, check whether other child processes inherited stale INT3 bytes
Defensive patterns

Strategy: try-catch

Validate before calling

ok, err := grp.Valid()
if !ok || err != nil {
    return fmt.Errorf("cannot enable breakpoint: targets not healthy: %v", err)
}

Type guard

func isBreakpointRollbackErr(err error) bool {
    return err != nil && strings.Contains(err.Error(), "could not be properly rolled back")
}

Try / catch

if err := grp.SetBreakpointEnabled(lbp, true); err != nil {
    if isBreakpointRollbackErr(err) {
        // state possibly inconsistent: restart session or detach/reattach
        return recoverSession(err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling SetBreakpointEnabled(lbp, true), ChangeBreakpointCondition, Restart, or manageUnsatisfiableBreakpoints when (a) SetBreakpoint fails on a target with a non-notfound/non-exists error (e.g. memory write failed, out of memory for software breakpoints) and (b) ValidTargets.ClearBreakpoint on an already-set physical breakpoint also errors (e.g. failed to restore original instruction bytes).

Common situations: Debugging a process whose memory became unreadable (crashed thread, exec churn); breakpoint set partially succeeded across multiple targets in a multi-process (follow-exec) group; corrupted text segment; permission loss mid-session.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/fbf1732c9c83377c. Report an issue: GitHub.