go-delve/delve · error

next while nexting

Error message

next while nexting

What it means

Returned by TargetGroup.Next when a stepping operation is requested while stepping breakpoints from a previous Next/Step are still installed. Delve implements step/next by planting temporary breakpoints; issuing another step before the previous one resolves would corrupt that state, so it is rejected with 'next while nexting'.

Source

Thrown at pkg/proc/target_exec.go:43

// ErrNoSourceForPC is returned when the given address
// does not correspond with a source file location.
type ErrNoSourceForPC struct {
	pc uint64
}

func (err *ErrNoSourceForPC) Error() string {
	return fmt.Sprintf("no source for PC %#x", err.pc)
}

// Next resumes the processes in the group, continuing the selected target
// until the next source line.
func (grp *TargetGroup) Next() (err error) {
	if _, err := grp.Valid(); err != nil {
		return err
	}
	if grp.HasSteppingBreakpoints() {
		return errors.New("next while nexting")
	}

	if err = next(grp.Selected, false, false); err != nil {
		grp.Selected.ClearSteppingBreakpoints()
		return
	}

	return grp.Continue()
}

// Continue continues execution of the debugged
// processes. It will continue until it hits a breakpoint
// or is otherwise stopped.
func (grp *TargetGroup) Continue() error {
	if grp.numValid() == 0 {
		_, err := grp.targets[0].Valid()
		return err
	}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Wait for the debugger to stop before issuing the next stepping command
  2. Call ClearSteppingBreakpoints (or continue to completion) before issuing another Next
  3. Recover from a failed next by clearing stepping breakpoints then retrying
  4. Serialize step requests in your client (queue commands, one in flight)

Example fix

// before
grp.Next()
err := grp.Next() // 'next while nexting'
// after
if grp.HasSteppingBreakpoints() {
    grp.Selected.ClearSteppingBreakpoints()
}
err := grp.Next()
Defensive patterns

Strategy: try-catch

Validate before calling

if grp.HasSteppingBreakpoints() {
    return fmt.Errorf("a step is already in progress")
}

Try / catch

if err := grp.Next(); err != nil && err.Error() == "next while nexting" {
    grp.Selected.ClearSteppingBreakpoints()
    err = grp.Next()
}

Prevention

When it happens

Trigger: Calling TargetGroup.Next() when grp.HasSteppingBreakpoints() is true — i.e. the process is stopped inside an unfinished next (or a previous next errored without clearing its breakpoints and you call Next again).

Common situations: Clients issuing 'next' twice from the IDE before the first next completes; script drivers (testseq2intl-style sequences) that step without waiting for stops; an aborted continue leaving stale stepping breakpoints.

Related errors


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