go-delve/delve · error
invalid interface type: %v
Error message
invalid interface type: %v
What it means
When unwrapping an interface value, Delve reads the itab's type pointer field. It first tries the field named 'Type' (internal/abi.Itab layout) then falls back to '_type' (older runtime layouts); if neither struct field exists in the itab DWARF type, the interface is marked unreadable.
Source
Thrown at pkg/proc/variables.go:2091
// +rtype -field iface.tab *itab|*internal/abi.ITab
// +rtype -field iface.data unsafe.Pointer
// +rtype -field eface._type *_type|*internal/abi.Type
// +rtype -field eface.data unsafe.Pointer
for _, f := range ityp.Field {
switch f.Name {
case "tab": // for runtime.iface
tab, _ := v.toField(f) // +rtype *itab|*internal/abi.ITab
tab = tab.maybeDereference()
isnil = tab.Addr == 0
if !isnil {
var err error
_type, err = tab.structField("Type") // +rtype *internal/abi.Type
if err != nil {
_type, err = tab.structField("_type") // +rtype *_type|*internal/abi.Type
if err != nil {
v.Unreadable = fmt.Errorf("invalid interface type: %v", err)
return
}
}
}
case "_type": // for runtime.eface
_type, _ = v.toField(f)
isnil = _type.maybeDereference().Addr == 0
case "data":
data, _ = v.toField(f)
}
}
return
}
func (v *Variable) loadInterface(recurseLevel int, loadData bool, cfg LoadConfig) {
_type, data, isnil := v.readInterface()
if isnil {View on GitHub (pinned to a23773e6c3)
Solutions
- Rebuild the debuggee with a Go version supported by your Delve build (or upgrade Delve to match the Go version)
- Verify the binary includes DWARF for the runtime package (don't strip with -w)
- Check the runtime ABI layout: search the binary's DWARF for internal/abi.Itab field names
- If inspecting a core dump, ensure the core and binary are from the same build
Example fix
// before: mismatched toolchain go build -gcflags="-N -l" main.go // built with go1.9-era runtime // after go1.21 build -gcflags="-N -l" main.go // + matching delve version
Defensive patterns
Strategy: fallback
Validate before calling
// Confirm runtime DWARF exposes abi.Itab fields before evaluating interfaces // search DWARF for struct internal/abi.Itab fields Type/_type
Try / catch
v, err := dbg.EvalVariable(scope, "myIface", cfg)
if err != nil && strings.Contains(fmt.Sprint(err), "invalid interface type") {
// upgrade delve / rebuild debuggee with supported Go version
} Prevention
- Keep Delve version aligned with the Go toolchain used to build the debuggee
- Never build debug binaries with -w (strips DWARF incl. runtime types)
- Use standard Go releases, not heavily patched runtimes
When it happens
Trigger: Printing an iface-typed value whose itab struct type (from the binary's runtime DWARF) lacks both 'Type' and '_type' fields — usually a Go version mismatch between the debugger's expectations and the debuggee runtime, or missing runtime DWARF.
Common situations: Debugging a binary built with a Go runtime whose internal abi.Type layout differs from what Delve expects; core dumps with incomplete runtime type info; optimized/stripped runtimes.
Related errors
- error loading module data: %v
- invalid interface type
- could not read %d bytes from register %d (size: %d), also er
- could not read %d bytes from register %d (size: %d)
- could not read %d bytes from address %#x: %v
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/7e39f27e3b78de61.
Report an issue: GitHub.