go-delve/delve · error

channel filter without eval scope

Error message

channel filter without eval scope

What it means

A channel filter needs an EvalScope because the filter's Arg is evaluated as a channel expression in the scope of a specific goroutine/frame. Without EvalScope there is no context in which to evaluate the channel argument, so the request is rejected.

Source

Thrown at service/rpc2/server.go:711

	//TODO(aarzilli): if arg contains a running goroutines filter (not negated)
	// and start == 0 and count == 0 then we can optimize this by just looking
	// at threads directly.

	var gs []*proc.G
	var nextg int
	var err error
	var gsLoaded bool

	for _, filter := range arg.Filters {
		if filter.Kind == api.GoroutineWaitingOnChannel {
			if filter.Negated {
				return errors.New("channel filter can not be negated")
			}
			if arg.Count == 0 {
				return errors.New("count == 0 not allowed with a channel filter")
			}
			if arg.EvalScope == nil {
				return errors.New("channel filter without eval scope")
			}
			gs, err = s.debugger.ChanGoroutines(arg.EvalScope.GoroutineID, arg.EvalScope.Frame, arg.EvalScope.DeferredCall, filter.Arg, arg.Start, arg.Count)
			if len(gs) == arg.Count {
				nextg = arg.Start + len(gs)
			} else {
				nextg = -1
			}
			gsLoaded = true
			break
		}
	}

	if !gsLoaded {
		gs, nextg, err = s.debugger.Goroutines(arg.Start, arg.Count)
	}
	if err != nil {
		return err
	}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Provide EvalScope with at least GoroutineID and Frame set (usually current goroutine, frame 0).
  2. Resolve the channel address first via variable evaluation, then pass scope + Arg.
  3. Skip the channel filter if no scope is available.

Example fix

// before
in := api.ListGoroutinesIn{Count: 100, Filters: channelFilters}
// after
in := api.ListGoroutinesIn{Count: 100, Filters: channelFilters, EvalScope: &api.EvalScope{GoroutineID: -1, Frame: 0}}
Defensive patterns

Strategy: validation

Validate before calling

if hasChannelFilter(filters) && in.EvalScope == nil {
    in.EvalScope = &api.EvalScope{GoroutineID: -1, Frame: 0}
}

Try / catch

err := client.Call("RPCServer.ListGoroutines", in, &out)
if err != nil && strings.Contains(err.Error(), "without eval scope") {
    in.EvalScope = &api.EvalScope{GoroutineID: -1, Frame: 0}
    err = client.Call("RPCServer.ListGoroutines", in, &out)
}

Prevention

When it happens

Trigger: ListGoroutines RPC with a GoroutineWaitingOnChannel filter but arg.EvalScope == nil (or omitted).

Common situations: Custom RPC clients or scripts that pass filters but never set EvalScope; UI code that only sets EvalScope for variable evaluation but not goroutine listing.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/cf668ba14a25486d. Report an issue: GitHub.