go-delve/delve · error
cannot restart process Delve did not create
Error message
cannot restart process Delve did not create
What it means
RPCServer.Restart refuses to restart a target process that Delve attached to rather than launched. Restart requires re-executing the program, which is only possible when Delve created the process itself; an attached (already-running) process cannot be relaunched.
Source
Thrown at service/rpc2/server.go:96
// When Rerecord is set the target will be rerecorded
Rerecord bool
// When Rebuild is set the process will be build again
Rebuild bool
NewRedirects [3]string
}
type RestartOut struct {
DiscardedBreakpoints []api.DiscardedBreakpoint
}
// Restart restarts program.
func (s *RPCServer) Restart(arg RestartIn, cb service.RPCCallback) {
close(cb.SetupDoneChan())
if s.config.Debugger.AttachPid != 0 {
cb.Return(nil, errors.New("cannot restart process Delve did not create"))
return
}
var out RestartOut
var err error
out.DiscardedBreakpoints, err = s.debugger.Restart(arg.Rerecord, arg.Position, arg.ResetArgs, arg.NewArgs, arg.NewRedirects, arg.Rebuild)
cb.Return(out, err)
}
type StateIn struct {
// If NonBlocking is true State will return immediately even if the target process is running.
NonBlocking bool
}
type StateOut struct {
State *api.DebuggerState
}
// State returns the current debugger state.View on GitHub (pinned to a23773e6c3)
Solutions
- Detach and relaunch the program under 'dlv debug' or 'dlv exec' instead of attaching.
- Exit the debug session, rebuild/restart the process, and attach to the new PID.
- Use rerun workflows only for processes Delve launched.
- Check AttachPid in your client before offering a restart option in the UI.
Example fix
// before (client always shows restart)
call := svc.Restart(restartIn)
// after
if debuggerAttachPid == 0 {
call := svc.Restart(restartIn)
} else {
fmt.Println("restart unavailable: attached to an existing process")
} Defensive patterns
Strategy: validation
Validate before calling
if attachPid != 0 {
return errors.New("restart not available for attached processes")
} Try / catch
var out rpc2.RestartOut
err := client.Call("RPCServer.Restart", in, &out)
if err != nil && strings.Contains(err.Error(), "Delve did not create") {
// fall back to relaunch workflow outside Delve
} Prevention
- Track whether the session was launched (debug/exec/test) or attached.
- Disable restart UI/actions when AttachPid != 0.
- Document restart semantics for embedded Delve users.
When it happens
Trigger: Calling the RPC Restart method (or 'restart' in a client) when the server was started with dlv attach, i.e. config.Debugger.AttachPid != 0.
Common situations: Developers debugging a running service via 'dlv attach <pid>' then issuing a restart command in the terminal or IDE expecting a re-launch.
Related errors
- waitfor not implemented
- could not decode first frame
- unable to find function context
- unable to find locals: no debug information present in binar
- no address for escaped variable
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/1a748f7ee433c1ac.
Report an issue: GitHub.