go-delve/delve · info

no return values

Error message

no return values

What it means

After an injected function call completes, Delve builds the call's result from the recorded return variables. If the finished function has zero return values, Delve cannot produce a result variable and marks the result unreadable with "no return values". This surfaces to users who call a void function and expect a printed return value.

Source

Thrown at pkg/proc/fncall.go:431

		} else {
			fncallLog("additional fncall error: %v", fncall.err)
		}
		return
	}

	if fncall.panicvar != nil {
		if stack.err == nil {
			stack.err = fncallPanicErr{fncall.panicvar}
		} else {
			fncallLog("additional fncall panic: %v", fncall.panicvar)
		}
		return
	}
	switch len(fncall.retvars) {
	case 0:
		r := newVariable("", 0, nil, scope.BinInfo, nil)
		r.loaded = true
		r.Unreadable = errors.New("no return values")
		stack.push(r)
	case 1:
		stack.push(fncall.retvars[0])
	default:
		// create a fake variable without address or type to return multiple values
		r := newVariable("", 0, nil, scope.BinInfo, nil)
		r.loaded = true
		r.Children = make([]Variable, len(fncall.retvars))
		for i := range fncall.retvars {
			r.Children[i] = *fncall.retvars[i]
		}
		stack.push(r)
	}
}

// fncallPanicErr is the error returned if a called function panics
type fncallPanicErr struct {
	panicVar *Variable

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Treat the call as side-effect only; the target state was changed, no value is returned
  2. Add return values to the called function if you need a result
  3. Use `print f(...)` only for functions that return values; for void functions observe the affected variables after the call

Example fix

// before
(dlv) call doSetup() // void; no return values
// after: inspect effects instead
(dlv) print cfg
dlv) call doSetup()
Defensive patterns

Strategy: fallback

Validate before calling

// only capture results from functions with return values
// check arity first:
// (dlv) print f // 0 results -> treat call as side-effect only

Try / catch

stack := scope.CallFunction(expr)
if rv := stack.Pop(); rv != nil && rv.Unreadable != nil && rv.Unreadable.Error() == "no return values" {
    // no result expected; observe affected variables instead
}

Prevention

When it happens

Trigger: Using `call f()` where f has no return values and then inspecting/pushing the call result (e.g. `call` on a void function whose result expression expects a value).

Common situations: Calling a void helper and trying to use its result; confusing print/call semantics for void functions; wrappers around procedures.

Related errors


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