{"record":{"id":"6707d36ac14df6fe","repo":"go-delve/delve","slug":"next-while-nexting","errorCode":null,"errorMessage":"next while nexting","messagePattern":"next while nexting","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/target_exec.go","lineNumber":43,"sourceCode":"\n// ErrNoSourceForPC is returned when the given address\n// does not correspond with a source file location.\ntype ErrNoSourceForPC struct {\n\tpc uint64\n}\n\nfunc (err *ErrNoSourceForPC) Error() string {\n\treturn fmt.Sprintf(\"no source for PC %#x\", err.pc)\n}\n\n// Next resumes the processes in the group, continuing the selected target\n// until the next source line.\nfunc (grp *TargetGroup) Next() (err error) {\n\tif _, err := grp.Valid(); err != nil {\n\t\treturn err\n\t}\n\tif grp.HasSteppingBreakpoints() {\n\t\treturn errors.New(\"next while nexting\")\n\t}\n\n\tif err = next(grp.Selected, false, false); err != nil {\n\t\tgrp.Selected.ClearSteppingBreakpoints()\n\t\treturn\n\t}\n\n\treturn grp.Continue()\n}\n\n// Continue continues execution of the debugged\n// processes. It will continue until it hits a breakpoint\n// or is otherwise stopped.\nfunc (grp *TargetGroup) Continue() error {\n\tif grp.numValid() == 0 {\n\t\t_, err := grp.targets[0].Valid()\n\t\treturn err\n\t}","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/target_exec.go#L25-L61","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Wait for the debugger to stop before issuing the next stepping command","Call ClearSteppingBreakpoints (or continue to completion) before issuing another Next","Recover from a failed next by clearing stepping breakpoints then retrying","Serialize step requests in your client (queue commands, one in flight)"],"exampleFix":"// before\ngrp.Next()\nerr := grp.Next() // 'next while nexting'\n// after\nif grp.HasSteppingBreakpoints() {\n    grp.Selected.ClearSteppingBreakpoints()\n}\nerr := grp.Next()","handlingStrategy":"try-catch","validationCode":"if grp.HasSteppingBreakpoints() {\n    return fmt.Errorf(\"a step is already in progress\")\n}","typeGuard":null,"tryCatchPattern":"if err := grp.Next(); err != nil && err.Error() == \"next while nexting\" {\n    grp.Selected.ClearSteppingBreakpoints()\n    err = grp.Next()\n}","preventionTips":["Await each stop event before issuing another step command","Queue stepping commands (one in flight per target)","Clear stepping breakpoints after failed steps"],"tags":["go","debugger","stepping","state"],"backgroundTag":"step-already-in-progress","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}