{"record":{"id":"fbf1732c9c83377c","repo":"go-delve/delve","slug":"error-while-creating-breakpoint-v-additionally","errorCode":null,"errorMessage":"error while creating breakpoint: %v, additionally the breakpoint could not be properly rolled back: %v","messagePattern":"error while creating breakpoint: (.+?), additionally the breakpoint could not be properly rolled back: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/target_group.go","lineNumber":365,"sourceCode":"\t}\n\tif errNotFound != nil && !didSet {\n\t\treturn errNotFound\n\t}\n\tif errExists != nil && !didSet {\n\t\treturn errExists\n\t}\n\tif !didSet {\n\t\tif _, err := grp.Valid(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err0 != nil {\n\t\tit := ValidTargets{Group: grp}\n\t\tfor it.Next() {\n\t\t\tfor _, bp := range it.Breakpoints().M {\n\t\t\t\tif bp.LogicalID() == lbp.LogicalID {\n\t\t\t\t\tif err1 := it.ClearBreakpoint(bp.Addr); err1 != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"error while creating breakpoint: %v, additionally the breakpoint could not be properly rolled back: %v\", err0, err1)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn err0\n\t}\n\treturn nil\n}\n\nfunc enableBreakpointOnTarget(p *Target, lbp *LogicalBreakpoint) error {\n\tif !lbp.enabled || !lbp.condSatisfiable {\n\t\treturn nil\n\t}\n\tvar err error\n\tvar addrs []uint64\n\tswitch {\n\tcase lbp.Set.File != \"\":\n\t\taddrs, err = FindFileLocation(p, lbp.Set.File, lbp.Set.Line)","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/target_group.go#L347-L383","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Fix the root cause in the first '%v' (the original SetBreakpoint error) first — it names the underlying failure","Check the rollback error; if it says breakpoint not found, the state may already be clean","Restart the debug session or detach and reattach to reset breakpoint state","Verify the breakpoint address is in executable, mapped memory in each target","For multi-process groups, check whether other child processes inherited stale INT3 bytes"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"ok, err := grp.Valid()\nif !ok || err != nil {\n    return fmt.Errorf(\"cannot enable breakpoint: targets not healthy: %v\", err)\n}","typeGuard":"func isBreakpointRollbackErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"could not be properly rolled back\")\n}","tryCatchPattern":"if err := grp.SetBreakpointEnabled(lbp, true); err != nil {\n    if isBreakpointRollbackErr(err) {\n        // state possibly inconsistent: restart session or detach/reattach\n        return recoverSession(err)\n    }\n    return err\n}","preventionTips":["Read memory-writability assumptions: ensure the text segment is mapped before enabling breakpoints","In multi-process groups, enable breakpoints only while all targets are stopped and valid","Treat this error as session-corrupting: plan a restart/reattach recovery path","Avoid enabling breakpoints concurrently from multiple goroutines"],"tags":["go","debugger","breakpoint","rollback"],"backgroundTag":"breakpoint-rollback-failed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}