go-delve/delve · error
cannot call function while another function call is already
Error message
cannot call function while another function call is already in progress
What it means
errFuncCallInProgress is returned by EvalExpressionWithCalls when a function-call injection is already running on the target; Delve allows only one injected call at a time per process. Issuing a second call before the first completes or is unwound would corrupt the injected-call state machine.
Source
Thrown at pkg/proc/fncall.go:61
// - evalop.CallInjectionStart
// - evalop.CallInjectionSetTarget
// - evalCallInjectionCopyArg
// - evalCallInjectionComplete
//
// When the target has runtime.debugPinner then evalCallInjectionPinPointer
// must be also called in a loop until it returns false.
const (
debugCallFunctionNamePrefix1 = "debugCall"
debugCallFunctionNamePrefix2 = "runtime.debugCall"
maxDebugCallVersion = 2
maxArgFrameSize = 65535
)
var (
errFuncCallUnsupported = errors.New("function calls not supported by this version of Go")
errFuncCallUnsupportedBackend = errors.New("backend does not support function calls")
errFuncCallInProgress = errors.New("cannot call function while another function call is already in progress")
errNoGoroutine = errors.New("no goroutine selected")
errGoroutineNotRunning = errors.New("selected goroutine not running")
errNotEnoughStack = errors.New("not enough stack space")
errTooManyArguments = errors.New("too many arguments")
errNotEnoughArguments = errors.New("not enough arguments")
errNotAGoFunction = errors.New("not a Go function")
errFuncCallNotAllowedStrAlloc = errors.New("literal string can not be allocated because function calls are not allowed without using 'call'")
)
type functionCallState struct {
// savedRegs contains the saved registers
savedRegs Registers
// err contains a saved error
err error
// expr is the expression being evaluated
expr *ast.CallExpr
// fn is the function that is being called
fn *FunctionView on GitHub (pinned to a23773e6c3)
Solutions
- Resume the target (continue) until the in-progress call finishes, then retry
- Use the unwind/cancel mechanism for the current call before issuing a new one
- Serialize function calls across clients: only one caller issues 'call' at a time
Example fix
// before: second call while first is paused dlv> call a() (dlv) call b() // errFuncCallInProgress // after dlv> call a() (dlv) continue // let a() finish (dlv) call b()
Defensive patterns
Strategy: retry
Validate before calling
// track injected-call state in your client; allow only one outstanding call var callInFlight bool
Try / catch
if errors.Is(err, proc.ErrFuncCallInProgress) {
time.Sleep(100 * time.Millisecond) // or continue until previous call completes, then retry once
} Prevention
- Complete or unwind the current function call before issuing another
- Serialize 'call' usage across multiple RPC clients
- After a call hits a breakpoint inside, continue to completion before new evaluations
When it happens
Trigger: Calling EvalExpressionWithCalls while an outstanding injected call is paused (e.g. the called function hit a breakpoint); issuing a second 'call' from a client before finishing/resuming the previous one; concurrent RPC clients issuing calls simultaneously.
Common situations: Multi-client setups where one client's 'call' is suspended at a breakpoint and another issues commands; scripted evaluations firing while a manual 'call' is in flight; forgetting to complete (continue/unwind) the first call.
Related errors
- selected goroutine not running
- function calls not allowed without using 'call'
- literal can not be allocated because function calls are not
- function calls not supported by this version of Go
- backend does not support function calls
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/34d207fc5a439ca6.
Report an issue: GitHub.