go-delve/delve · error

package %s has no function %s

Error message

package %s has no function %s

What it means

When the expression looks like package.Function and the loaded function pointer variable is a plain function (not a closure), Delve checks whether vname is a known package in bi.PackageMap. If it is, this error reports that the package exists but contains no function of that name — a package/function name mismatch.

Source

Thrown at pkg/proc/variables.go:1170

				return &v.Children[i], nil
			}
		}
		return nil, fmt.Errorf("%s has no member %s", vname, memberName)
	}
	closure := false
	switch v.Kind {
	case reflect.Chan:
		v = v.clone()
		v.RealType = godwarf.ResolveTypedef(&(v.RealType.(*godwarf.ChanType).TypedefType))
	case reflect.Func:
		fn := v.bi.PCToFunc(v.Base)
		v.loadFunctionPtr(0, LoadConfig{MaxVariableRecurse: -1})
		if v.Unreadable != nil {
			cst := fn.extra(v.bi).closureStructType
			if cst == nil || cst.ByteSize == 0 {
				// Not a closure, normal function
				if _, ok := v.bi.PackageMap[vname]; ok {
					return nil, fmt.Errorf("package %s has no function %s", vname, memberName)
				}
				return nil, fmt.Errorf("%s has no member %s", vname, memberName)
			}
			return nil, v.Unreadable
		}
		if v.closureAddr != 0 {
			fn = v.bi.PCToFunc(v.Base)
			if fn != nil {
				cst := fn.extra(v.bi).closureStructType
				v = v.newVariable(v.Name, v.closureAddr, cst, v.mem)
				closure = true
			}
		}
	}

	structVar := v.maybeDereference()
	structVar.Name = v.Name
	if structVar.Unreadable != nil {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Verify the function exists and is exported in that package (go doc pkgname).
  2. Use the full import path if the package name is ambiguous (e.g. math/rand vs crypto/rand).
  3. Check the functions command in the terminal to search available function symbols.
  4. Disable inlining in the build (-gcflags=all='-N -l') so symbols are not optimized away.

Example fix

// before
dlv> eval mypkg.helper
Command failed: package mypkg has no function helper

// after
dlv> functions mypkg.helper   // confirm symbol
dlv> eval mypkg.Helper        // correct name/case
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the function symbol before evaluating pkg.Func
funcs, err := client.ListFunctions(pkgName)
if err != nil { return err }
found := false
for _, f := range funcs { if strings.Contains(f, "."+funcName) { found = true; break } }
if !found { return fmt.Errorf("symbol %s.%s not found", pkgName, funcName) }

Try / catch

v, err := client.EvalVariable(scope, pkg+"."+fn, cfg)
if err != nil && strings.Contains(err.Error(), "has no function") {
    // fall back to ListFunctions search or breakpoint by function name instead
}

Prevention

When it happens

Trigger: Evaluating 'pkgname.FuncName' where pkgname is a valid Go package in the binary but no exported symbol FuncName exists in it (misspelling, unexported function, or function inlined/optimized away).

Common situations: Case mistakes (pkg.funcname for unexported funcs), functions removed by the linker or inlined so no symbol exists, referring to a different package path than imported.

Related errors


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