go-delve/delve · error

reading desc: %v

Error message

reading desc: %v

What it means

readNote wraps a failed read of the note descriptor (hdr.Descsz bytes) with this message. The descriptor holds the actual note payload (registers, process info, etc.), so when it cannot be read the whole note and thus the core file is unusable. Delve surfaces the underlying reader error wrapped in this context.

Source

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

	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:
			note.Desc = &linuxPrStatusRISCV64{}
		case _EM_LOONGARCH:
			note.Desc = &linuxPrStatusLOONG64{}
		default:
			return nil, errors.New("unsupported machine type")
		}
		if err := binary.Read(descReader, binary.LittleEndian, note.Desc); err != nil {
			return nil, fmt.Errorf("reading NT_PRSTATUS: %v", err)

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Verify the core file size is complete and re-dump with an adequate ulimit -c (ulimit -c unlimited).
  2. Re-transfer the core file and compare checksums with the source.
  3. Validate the core with readelf -n <core>; if it fails, the file is corrupt — regenerate it.
  4. Free disk space / check mount health if the dump was written on a full or failing volume.

Example fix

// before
cmd := exec.Command("dlv", "core", binary, "core")
cmd.Run()
// after
if fi, err := os.Stat(corePath); err == nil && fi.Size() < minExpectedCoreSize {
    return fmt.Errorf("core file %s truncated (%d bytes), re-dump with ulimit -c unlimited", corePath, fi.Size())
}
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the core is complete and its notes parse with an external tool before Delve:
cmd := exec.Command("readelf", "-n", corePath)
if out, err := cmd.CombinedOutput(); err != nil {
    return fmt.Errorf("core file %s has invalid notes: %v (%s)", corePath, err, out)
}

Prevention

When it happens

Trigger: The core file ends after the note header/name/padding but before Descsz descriptor bytes, or the underlying reader (r.Read) returns an I/O error while reading the descriptor during dlv core parsing.

Common situations: Truncated core dumps from ulimit -c, disk-full during dump generation, interrupted file transfers, or a corrupted core file downloaded from a CI artifact store.

Related errors


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