go-delve/delve · error

reading name: %v

Error message

reading name: %v

What it means

readNote parses one ELF note: after reading the 12-byte Elf_Nhdr it reads Namesz bytes of the note name. Any read failure there (EOF or I/O error) is wrapped as 'reading name: %v' and propagated; readNotes treats EOF specially to end note iteration cleanly.

Source

Thrown at pkg/proc/core/linux_core.go:313

	return notes, hasDelveThread && hasDelveHeader && !hasElfPrStatus, nil
}

// readNote reads a single note from r, decoding the descriptor if possible.
func readNote(r io.ReadSeeker, machineType elf.Machine) (*note, error) {
	// Notes are laid out as described in the SysV ABI:
	// https://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section
	note := &note{}
	hdr := &elfNotesHdr{}

	err := binary.Read(r, binary.LittleEndian, hdr)
	if err != nil {
		return nil, err // don't wrap so readNotes sees EOF.
	}
	note.Type = elf.NType(hdr.Type)

	name := make([]byte, hdr.Namesz)
	if _, err := r.Read(name); err != nil {
		return nil, fmt.Errorf("reading name: %v", err)
	}
	note.Name = string(name)
	if err := skipPadding(r, 4); err != nil {
		return nil, fmt.Errorf("aligning after name: %v", err)
	}
	desc := make([]byte, hdr.Descsz)
	if _, err := r.Read(desc); err != nil {
		return nil, fmt.Errorf("reading desc: %v", err)
	}
	descReader := bytes.NewReader(desc)
	switch note.Type {
	case elf.NT_PRSTATUS:
		switch machineType {
		case _EM_X86_64:
			note.Desc = &linuxPrStatusAMD64{}
		case _EM_AARCH64:
			note.Desc = &linuxPrStatusARM64{}
		case _EM_RISCV:

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Re-obtain a complete core file and verify its size/checksum.
  2. Check ELF headers (readelf -n) to confirm the note region matches the file contents.
  3. Regenerate the core dump with delve.
  4. If EOF-only, note that readNotes may treat it as the end of notes — investigate the producing tool if notes are missing.

Example fix

// before (truncated dump)
-rw-r--r-- 1 user user 800M core  # dump interrupted
// after
$ ulimit -c unlimited && <reproduce crash> && sha256sum core  # verified complete
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the note section is fully backed by file bytes
if noteEnd > fi.Size() {
	return fmt.Errorf("note region [%d,%d) exceeds file size %d", noteStart, noteEnd, fi.Size())
}

Try / catch

p, err := core.ReadFile(exePath, corePath)
if err != nil {
	if strings.Contains(err.Error(), "reading name:") {
		log.Printf("note stream ended mid-note (%v); core likely truncated — re-dump", err)
	}
	return err
}

Prevention

When it happens

Trigger: readLinuxOrPlatformIndependentCore -> readNotes -> readNote: the note-section reader fails while reading hdr.Namesz bytes of a note name — i.e. the notes region ends exactly at a note header boundary or an I/O error occurs.

Common situations: Truncated core file whose note section claims more notes than the bytes present; corrupted section/program headers giving wrong note-region size; storage errors while reading the file.

Related errors


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