go-delve/delve · error
could not find DIE for function %q
Error message
could not find DIE for function %q
What it means
After evaluating the function expression, Delve uses PCToFunc to map the function's code address back to a Function (DIE) in the debug info. If the base address doesn't correspond to any known function, this error is returned, meaning the debug info lacks the entry for the target.
Source
Thrown at pkg/proc/fncall.go:523
// funcCallEvalFuncExpr evaluates expr.Fun and returns the function that we're trying to call.
// If allowCalls is false function calls will be disabled even if scope.callCtx != nil
func funcCallEvalFuncExpr(scope *EvalScope, stack *evalStack, fncall *functionCallState) error {
bi := scope.BinInfo
fnvar := stack.peek()
if fnvar.Kind != reflect.Func {
return fmt.Errorf("expression %q is not a function", astutil.ExprToString(fncall.expr.Fun))
}
fnvar.loadValue(LoadConfig{false, 0, 0, 0, 0, 0})
if fnvar.Unreadable != nil {
return fnvar.Unreadable
}
if fnvar.Base == 0 {
return errors.New("nil pointer dereference")
}
fncall.fn = bi.PCToFunc(fnvar.Base)
if fncall.fn == nil {
return fmt.Errorf("could not find DIE for function %q", astutil.ExprToString(fncall.expr.Fun))
}
if !fncall.fn.cu.isgo {
return errNotAGoFunction
}
fncall.closureAddr = fnvar.closureAddr
var err error
fncall.argFrameSize, fncall.formalArgs, err = funcCallArgs(fncall.fn, bi, false)
if err != nil {
return err
}
argnum := len(fncall.expr.Args)
// If the function variable has a child then that child is the method
// receiver. However, if the method receiver is not being used (e.g.
// func (_ X) Foo()) then it will not actually be listed as a formal
// argument. Ensure that we are really off by 1 to add the receiver toView on GitHub (pinned to a23773e6c3)
Solutions
- Rebuild the binary with full debug info (-gcflags=all="-N -l") and restart the debug session
- Avoid calling assembly or cgo functions via call injection
- Check that the loaded binary matches the running process
Defensive patterns
Strategy: validation
Validate before calling
if dbg.BinInfo().PCToFunc(fnvar.Base) == nil {
return errors.New("target function has no debug info; rebuild with -gcflags=all=\"-N -l\"")
} Try / catch
if err != nil && strings.Contains(err.Error(), "could not find DIE") {
// fall back to breakpoints/stepping instead of call injection
} Prevention
- Always debug the exact binary you built, unstripped
- Avoid calling assembly, cgo, or runtime stubs via call injection
When it happens
Trigger: Calling a function whose address comes from a func-valued variable but whose code region is not covered by the loaded DWARF info, e.g. an assembly function, a symbol from a stripped shared library, or a corrupted fn.Base.
Common situations: Calling into cgo/assembly code; binary rebuilt (stale symbols) while debugger attached; calling function pointers into runtime/assembly stubs without DWARF entries.
Related errors
- DWARF read error: %v
- could not get argument location of %s: %v
- unsupported location expression for argument %s: %v
- unsupported location expression for argument %s (uses DW_OP_
- unable to find function context
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/e5702d14bdb547a9.
Report an issue: GitHub.