go-delve/delve · error
no goroutine selected
Error message
no goroutine selected
What it means
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.
Source
Thrown at pkg/proc/fncall.go:62
// - 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 *Function
// receiver is the receiver argument for the functionView on GitHub (pinned to a23773e6c3)
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
Example fix
// before dlv> call foo(1) // no goroutine selected // after dlv> goroutine 1 dlv> call foo(1)
Defensive patterns
Strategy: validation
Validate before calling
// ensure a goroutine is selected before calling dlv> goroutines dlv> goroutine <id> dlv> call foo(1)
Try / catch
if errors.Is(err, proc.ErrNoGoroutine) {
// select the current goroutine (API: scope with GoroutineID set) and retry
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
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/669db08c7edfe27a.
Report an issue: GitHub.