{"record":{"id":"34d207fc5a439ca6","repo":"go-delve/delve","slug":"cannot-call-function-while-another-function-call-i","errorCode":null,"errorMessage":"cannot call function while another function call is already in progress","messagePattern":"cannot call function while another function call is already in progress","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":61,"sourceCode":"//  - evalop.CallInjectionStart\n//  - evalop.CallInjectionSetTarget\n//  - evalCallInjectionCopyArg\n//  - evalCallInjectionComplete\n//\n// When the target has runtime.debugPinner then evalCallInjectionPinPointer\n// must be also called in a loop until it returns false.\n\nconst (\n\tdebugCallFunctionNamePrefix1 = \"debugCall\"\n\tdebugCallFunctionNamePrefix2 = \"runtime.debugCall\"\n\tmaxDebugCallVersion          = 2\n\tmaxArgFrameSize              = 65535\n)\n\nvar (\n\terrFuncCallUnsupported        = errors.New(\"function calls not supported by this version of Go\")\n\terrFuncCallUnsupportedBackend = errors.New(\"backend does not support function calls\")\n\terrFuncCallInProgress         = errors.New(\"cannot call function while another function call is already in progress\")\n\terrNoGoroutine                = errors.New(\"no goroutine selected\")\n\terrGoroutineNotRunning        = errors.New(\"selected goroutine not running\")\n\terrNotEnoughStack             = errors.New(\"not enough stack space\")\n\terrTooManyArguments           = errors.New(\"too many arguments\")\n\terrNotEnoughArguments         = errors.New(\"not enough arguments\")\n\terrNotAGoFunction             = errors.New(\"not a Go function\")\n\terrFuncCallNotAllowedStrAlloc = errors.New(\"literal string can not be allocated because function calls are not allowed without using 'call'\")\n)\n\ntype functionCallState struct {\n\t// savedRegs contains the saved registers\n\tsavedRegs Registers\n\t// err contains a saved error\n\terr error\n\t// expr is the expression being evaluated\n\texpr *ast.CallExpr\n\t// fn is the function that is being called\n\tfn *Function","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before: second call while first is paused\ndlv> call a()\n(dlv) call b()   // errFuncCallInProgress\n// after\ndlv> call a()\n(dlv) continue   // let a() finish\n(dlv) call b()","handlingStrategy":"retry","validationCode":"// track injected-call state in your client; allow only one outstanding call\nvar callInFlight bool","typeGuard":null,"tryCatchPattern":"if errors.Is(err, proc.ErrFuncCallInProgress) {\n    time.Sleep(100 * time.Millisecond) // or continue until previous call completes, then retry once\n}","preventionTips":["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"],"tags":["go","function-call","concurrency","state"],"backgroundTag":"func-call-in-progress","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}