go-delve/delve · error

error reading thread note header for thread %d: %v

Error message

error reading thread note header for thread %d: %v

What it means

While parsing each thread note, threadsFromDelveNotes reads fixed-size header fields (goroutine/thread id, gaddr, register count n) via a local read helper that records the first error in readerr. If any of those reads fail (typically EOF), the whole thread-note parse is aborted with this wrapped error identifying the thread id.

Source

Thrown at pkg/proc/core/delve_core.go:88

				return
			}
			readerr = binary.Read(body, binary.LittleEndian, out)
		}

		read(&th.id)

		read(&th.regs.pc)
		read(&th.regs.sp)
		read(&th.regs.bp)
		read(&th.regs.tls)
		read(&th.regs.hasGAddr)
		read(&th.regs.gaddr)

		var n uint32
		read(&n)

		if readerr != nil {
			return nil, fmt.Errorf("error reading thread note header for thread %d: %v", th.id, readerr)
		}

		th.regs.slice = make([]proc.Register, n)

		readBytes := func(maxlen uint16, kind string) []byte {
			if readerr != nil {
				return nil
			}
			var len uint16
			read(&len)
			if maxlen > 0 && len > maxlen {
				readerr = fmt.Errorf("maximum len exceeded (%d) reading %s", len, kind)
				return nil
			}
			if readerr != nil {
				return nil
			}
			buf := make([]byte, len)

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Re-acquire a complete, untruncated copy of the core file.
  2. Validate the ELF note section sizes (compare file size to section/program headers).
  3. Regenerate the core dump with delve.
  4. Check the writing tool version against the reader version for note-layout compatibility.

Example fix

// before (truncated transfer)
$ scp core ... # interrupted, 80% copied
// after
$ sha256sum core && cmp core core.orig # verify integrity before loading
Defensive patterns

Strategy: fallback

Validate before calling

// Ensure the note region is fully present before parsing threads
if fi.Size() < notesEndOffset {
	return fmt.Errorf("core file truncated: %d < %d bytes", fi.Size(), notesEndOffset)
}

Try / catch

p, err := core.ReadFile(exePath, corePath)
if err != nil {
	var serr *fmt.Errorf // wrap carries thread id
	log.Printf("core thread-note header read failed (%v); re-dump the core", err)
	return err
}

Prevention

When it happens

Trigger: readLinuxOrPlatformIndependentCore -> threadsFromDelveNotes: the reader hits EOF or an I/O error while reading a thread note's header fields (id/gaddr/register-count) in a delve-format core.

Common situations: Truncated core file (partial transfer or interrupted dump); corrupted note section; a writer bug producing fewer header bytes than the reader expects.

Related errors


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