{"record":{"id":"669db08c7edfe27a","repo":"go-delve/delve","slug":"no-goroutine-selected","errorCode":null,"errorMessage":"no goroutine selected","messagePattern":"no goroutine selected","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":62,"sourceCode":"//  - 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\n\t// receiver is the receiver argument for the function","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L44-L80","documentation":"errNoGoroutine is returned by EvalExpressionWithCalls when no goroutine is currently selected as the scope for the injected call. Function-call injection needs a specific goroutine context to run the call on, and none is set.","triggerScenarios":"Calling EvalExpressionWithCalls without a current goroutine selected (no 'goroutine N' / SetCurrentGoroutine beforehand); evaluating in a scope where the selected thread has no associated goroutine; API clients omitting the goroutine ID.","commonSituations":"Fresh RPC sessions where the client never selected a goroutine; scripts that switch threads but not goroutines; evaluations issued while the target is in a state without a current goroutine.","solutions":["Select a goroutine first: use 'goroutine <id>' in the terminal or SetCurrentGoroutine / scope.GoroutineID via the API","List goroutines with 'goroutines' and pick a runnable (Running) one","Retry the call after the goroutine scope is established"],"exampleFix":"// before\ndlv> call foo(1)        // no goroutine selected\n// after\ndlv> goroutine 1\ndlv> call foo(1)","handlingStrategy":"validation","validationCode":"// ensure a goroutine is selected before calling\ndlv> goroutines\ndlv> goroutine <id>\ndlv> call foo(1)","typeGuard":null,"tryCatchPattern":"if errors.Is(err, proc.ErrNoGoroutine) {\n    // select the current goroutine (API: scope with GoroutineID set) and retry\n}","preventionTips":["Always run 'goroutine <id>' (or set GoroutineID in the eval scope) before 'call'","In RPC clients, populate EvalScope.GoroutineID explicitly","Pick a goroutine from the 'goroutines' listing rather than assuming a default"],"tags":["go","function-call","goroutine","scope"],"backgroundTag":"no-goroutine-selected","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}