{"record":{"id":"d7b1e671e4b0d562","repo":"go-delve/delve","slug":"call-stopped","errorCode":null,"errorMessage":"call stopped","messagePattern":"call stopped","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"service/dap/server.go","lineNumber":3459,"sourceCode":"\t// to reset all the handles (both variables and stack frames).\n\t//\n\t// We considered sending a stopped event after each call unconditionally, but a stopped\n\t// event can be expensive and can interact badly with the client-side optimization\n\t// to refresh information. For example, VS Code reissues scopes/evaluate (for watch) after\n\t// completing a setVariable or evaluate request for repl context. Thus, for now, we\n\t// do not trigger a stopped event and hope editors to refetch the updated state as soon\n\t// as the user resumes debugging.\n\n\tif !found || !isAssignment && retVars == nil {\n\t\t// The call got interrupted by a stop (e.g. breakpoint in injected\n\t\t// function call or in another goroutine).\n\t\ts.resetHandlesForStoppedEvent()\n\t\ts.sendStoppedEvent(state)\n\n\t\t// TODO(polina): once this is asynchronous, we could wait to reply until the user\n\t\t// continues, call ends, original stop point is hit and return values are available\n\t\t// instead of returning an error 'call stopped' here.\n\t\treturn nil, nil, errors.New(\"call stopped\")\n\t}\n\treturn state, retVars, nil\n}\n\nfunc (s *Session) sendStoppedEvent(state *api.DebuggerState) {\n\tstopped := &dap.StoppedEvent{Event: *s.newEvent(\"stopped\")}\n\tstopped.Body.AllThreadsStopped = true\n\tstopped.Body.ThreadId = int(stoppedGoroutineID(state))\n\tstopped.Body.Reason = s.debugger.StopReason().String()\n\ts.send(stopped)\n}\n\n// onTerminateRequest sends a not-yet-implemented error response.\n// Capability 'supportsTerminateRequest' is not set in 'initialize' response.\nfunc (s *Session) onTerminateRequest(request *dap.TerminateRequest) {\n\ts.sendNotYetImplementedErrorResponse(request.Request)\n}\n","sourceCodeStart":3441,"sourceCodeEnd":3477,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/dap/server.go#L3441-L3477","documentation":"After an injected function call is issued, if the target stops (a breakpoint is hit, signal arrives, etc.) before the call completes, the session sends a stopped event, resets handles, and returns the sentinel 'call stopped' instead of a result. The call was injected but its completion is interrupted; delve currently cannot resume and complete it transparently.","triggerScenarios":"An injected call crosses a breakpoint that fires mid-call; a signal or manual pause lands while the call executes; stepping/other stop events occur during the injected call.","commonSituations":"Calling a function whose body contains breakpoints while evaluating from the console; hitting an async signal during a long-running injected call; user pressing pause during a slow call evaluation.","solutions":["Disable or remove breakpoints along the called function's path before evaluating the call","Retry the call after continuing; the call result is not available and the original stop point must be resumed","Avoid evaluating functions that trigger signals or long pauses","If a stop is needed, cancel the call workflow and set a proper breakpoint instead of injecting a call"],"exampleFix":"// before: evaluate call with a breakpoint inside callee\n{expression: 'compute(x)'} // breakpoint in compute -> 'call stopped'\n// after: clear the breakpoint first\ndeleteBreakpoint(computeLine)\n{expression: 'compute(x)'}","handlingStrategy":"retry","validationCode":"// remove breakpoints in the callee path before injecting the call\nfor _, bp := range breakpointsInFunc(calleeName) { removeBreakpoint(bp.ID) }","typeGuard":null,"tryCatchPattern":"if err.Error() == \"call stopped\" {\n    // a stop event already arrived; continue execution, wait for the original\n    // stop point, then retry the call once breakpoints are cleared\n}","preventionTips":["Clear breakpoints along the called function's route before call evaluation","Do not pause/signal the target while a call is in flight","Keep injected calls short and side-effect free"],"tags":["dap","function-call","breakpoints","go"],"backgroundTag":"call-stopped-mid-injection","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}