go-delve/delve · error

error loading module data: %v

Error message

error loading module data: %v

What it means

After obtaining an interface's runtime type (*_type), Delve loads the runtime's moduledata (needed to map runtime types back to DWARF compile units via type offsets). Any failure reading or parsing moduledata marks the interface unreadable.

Source

Thrown at pkg/proc/variables.go:2126

	if isnil {
		// interface to nil
		data = data.maybeDereference()
		v.Children = []Variable{*data}
		if loadData {
			v.Children[0].loadValueInternal(recurseLevel, cfg)
		}
		return
	}

	if data == nil {
		v.Unreadable = errors.New("invalid interface type")
		return
	}

	mds, err := _type.bi.getModuleData(_type.mem)
	if err != nil {
		v.Unreadable = fmt.Errorf("error loading module data: %v", err)
		return
	}

	typ, directIface, err := RuntimeTypeToDIE(_type, data.Addr, mds)
	if err != nil {
		v.Unreadable = err
		return
	}

	deref := false
	if !directIface {
		realtyp := godwarf.ResolveTypedef(typ)
		if _, isptr := realtyp.(*godwarf.PtrType); !isptr {
			typ = pointerTo(typ, v.bi.Arch)
			deref = true
		}
	}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Rebuild with standard 'go build' and default buildmode so firstmoduledata is present and standard-shaped
  2. Upgrade Delve if the debuggee uses a newer Go runtime with changed moduledata layout
  3. For core dumps, ensure the core captured the data segment containing moduledata (full core)
  4. Check the binary wasn't post-processed (stripped/packed) in ways that removed or moved moduledata symbols
Defensive patterns

Strategy: fallback

Validate before calling

// Verify firstmoduledata is present and readable
md, err := bi.getModuleData(mem)
if err != nil { /* interface concrete-type resolution unavailable */ }

Try / catch

if v, err := dbg.EvalVariable(scope, expr, cfg); err != nil || v.Unreadable != nil {
    // fall back to printing raw interface fields (tab/data words)
}

Prevention

When it happens

Trigger: Printing an interface whose concrete type resolution requires getModuleData, when the moduledata memory is unreadable, the firstmoduledata symbol is missing from the binary, or the moduledata contents fail validation.

Common situations: Debugging binaries built with unusual linkers (external linking plugins, -buildmode=c-archive) where moduledata layout/symbols differ; core dumps missing the pages holding moduledata; Go version mismatches.

Related errors


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