go-delve/delve · error

ErrTypeNotFound

ErrTypeNotFound

Error message

no type entry found, use 'types' for a list of valid types

What it means

ErrTypeNotFound is the sentinel error of pkg/dwarf/reader meaning the requested type could not be located in the DWARF info. SeekToType, SeekToTypeNamed and the compileTypeCast/compileTypeCastOrFuncCall helpers return it when no matching DW_TAG_*_type entry exists.

Source

Thrown at pkg/dwarf/reader/reader.go:53

// AddrFor returns the address for the named entry.
func (reader *Reader) AddrFor(name string, staticBase uint64, ptrSize int) (uint64, error) {
	entry, err := reader.FindEntryNamed(name, false)
	if err != nil {
		return 0, err
	}
	instructions, ok := entry.Val(dwarf.AttrLocation).([]byte)
	if !ok {
		return 0, errors.New("type assertion failed")
	}
	addr, _, err := op.ExecuteStackProgram(op.DwarfRegisters{StaticBase: staticBase}, instructions, ptrSize, nil)
	if err != nil {
		return 0, err
	}
	return uint64(addr), nil
}

var ErrTypeNotFound = errors.New("no type entry found, use 'types' for a list of valid types")

// SeekToType moves the reader to the type specified by the entry,
// optionally resolving typedefs and pointer types. If the reader is set
// to a struct type the NextMemberVariable call can be used to walk all member data.
func (reader *Reader) SeekToType(entry *dwarf.Entry, resolveTypedefs bool, resolvePointerTypes bool) (*dwarf.Entry, error) {
	offset, ok := entry.Val(dwarf.AttrType).(dwarf.Offset)
	if !ok {
		return nil, errors.New("entry does not have a type attribute")
	}

	// Seek to the first type offset
	reader.Seek(offset)

	// Walk the types to the base
	for typeEntry, err := reader.Next(); typeEntry != nil; typeEntry, err = reader.Next() {
		if err != nil {
			return nil, err
		}

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Verify the type name spelling and that it is present (dlv 'types' command / readelf --debug-dump=info)
  2. Rebuild the binary with full debug info (-gcflags="all=-N -l", without -w/-s)
  3. Handle errors.Is(err, reader.ErrTypeNotFound) to return a user-facing 'type not found' message
Defensive patterns

Strategy: try-catch

Try / catch

entry, err := reader.SeekToTypeNamed("MyType")
if errors.Is(err, reader.ErrTypeNotFound) { /* user-facing 'unknown type' message */ }

Prevention

When it happens

Trigger: SeekToTypeNamed for a type name absent from debug info; SeekToType walking an AttrType chain that terminates without a valid type; compiling a type cast expression for a type that does not exist in the binary's DWARF.

Common situations: Typo'd or non-exported type names at the call site, stripped or missing debug info (build with -w), or types eliminated by the linker/compiler that have no DWARF entry.

Related errors


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