{"record":{"id":"cb3580790aab2ea5","repo":"go-delve/delve","slug":"error-reading-thread-note-header-for-thread-d-v","errorCode":null,"errorMessage":"error reading thread note header for thread %d: %v","messagePattern":"error reading thread note header for thread (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/delve_core.go","lineNumber":88,"sourceCode":"\t\t\t\treturn\n\t\t\t}\n\t\t\treaderr = binary.Read(body, binary.LittleEndian, out)\n\t\t}\n\n\t\tread(&th.id)\n\n\t\tread(&th.regs.pc)\n\t\tread(&th.regs.sp)\n\t\tread(&th.regs.bp)\n\t\tread(&th.regs.tls)\n\t\tread(&th.regs.hasGAddr)\n\t\tread(&th.regs.gaddr)\n\n\t\tvar n uint32\n\t\tread(&n)\n\n\t\tif readerr != nil {\n\t\t\treturn nil, fmt.Errorf(\"error reading thread note header for thread %d: %v\", th.id, readerr)\n\t\t}\n\n\t\tth.regs.slice = make([]proc.Register, n)\n\n\t\treadBytes := func(maxlen uint16, kind string) []byte {\n\t\t\tif readerr != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tvar len uint16\n\t\t\tread(&len)\n\t\t\tif maxlen > 0 && len > maxlen {\n\t\t\t\treaderr = fmt.Errorf(\"maximum len exceeded (%d) reading %s\", len, kind)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif readerr != nil {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tbuf := make([]byte, len)","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/delve_core.go#L70-L106","documentation":"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.","triggerScenarios":"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.","commonSituations":"Truncated core file (partial transfer or interrupted dump); corrupted note section; a writer bug producing fewer header bytes than the reader expects.","solutions":["Re-acquire a complete, untruncated copy of the core file.","Validate the ELF note section sizes (compare file size to section/program headers).","Regenerate the core dump with delve.","Check the writing tool version against the reader version for note-layout compatibility."],"exampleFix":"// before (truncated transfer)\n$ scp core ... # interrupted, 80% copied\n// after\n$ sha256sum core && cmp core core.orig # verify integrity before loading","handlingStrategy":"fallback","validationCode":"// Ensure the note region is fully present before parsing threads\nif fi.Size() < notesEndOffset {\n\treturn fmt.Errorf(\"core file truncated: %d < %d bytes\", fi.Size(), notesEndOffset)\n}","typeGuard":null,"tryCatchPattern":"p, err := core.ReadFile(exePath, corePath)\nif err != nil {\n\tvar serr *fmt.Errorf // wrap carries thread id\n\tlog.Printf(\"core thread-note header read failed (%v); re-dump the core\", err)\n\treturn err\n}","preventionTips":["Transfer cores with checksum verification (sha256sum).","Avoid interrupting dumps or copying partial files.","Keep writer and reader delve versions in sync.","Check disk space where dumps are written."],"tags":["core-dump","truncated-file","io-error"],"backgroundTag":"truncated-core-file","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}