{"record":{"id":"ca6d886e46894b52","repo":"go-delve/delve","slug":"reading-name-v","errorCode":null,"errorMessage":"reading name: %v","messagePattern":"reading name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/linux_core.go","lineNumber":313,"sourceCode":"\treturn notes, hasDelveThread && hasDelveHeader && !hasElfPrStatus, nil\n}\n\n// readNote reads a single note from r, decoding the descriptor if possible.\nfunc readNote(r io.ReadSeeker, machineType elf.Machine) (*note, error) {\n\t// Notes are laid out as described in the SysV ABI:\n\t// https://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section\n\tnote := &note{}\n\thdr := &elfNotesHdr{}\n\n\terr := binary.Read(r, binary.LittleEndian, hdr)\n\tif err != nil {\n\t\treturn nil, err // don't wrap so readNotes sees EOF.\n\t}\n\tnote.Type = elf.NType(hdr.Type)\n\n\tname := make([]byte, hdr.Namesz)\n\tif _, err := r.Read(name); err != nil {\n\t\treturn nil, fmt.Errorf(\"reading name: %v\", err)\n\t}\n\tnote.Name = string(name)\n\tif err := skipPadding(r, 4); err != nil {\n\t\treturn nil, fmt.Errorf(\"aligning after name: %v\", err)\n\t}\n\tdesc := make([]byte, hdr.Descsz)\n\tif _, err := r.Read(desc); err != nil {\n\t\treturn nil, fmt.Errorf(\"reading desc: %v\", err)\n\t}\n\tdescReader := bytes.NewReader(desc)\n\tswitch note.Type {\n\tcase elf.NT_PRSTATUS:\n\t\tswitch machineType {\n\t\tcase _EM_X86_64:\n\t\t\tnote.Desc = &linuxPrStatusAMD64{}\n\t\tcase _EM_AARCH64:\n\t\t\tnote.Desc = &linuxPrStatusARM64{}\n\t\tcase _EM_RISCV:","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/linux_core.go#L295-L331","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-obtain a complete core file and verify its size/checksum.","Check ELF headers (readelf -n) to confirm the note region matches the file contents.","Regenerate the core dump with delve.","If EOF-only, note that readNotes may treat it as the end of notes — investigate the producing tool if notes are missing."],"exampleFix":"// before (truncated dump)\n-rw-r--r-- 1 user user 800M core  # dump interrupted\n// after\n$ ulimit -c unlimited && <reproduce crash> && sha256sum core  # verified complete","handlingStrategy":"try-catch","validationCode":"// Confirm the note section is fully backed by file bytes\nif noteEnd > fi.Size() {\n\treturn fmt.Errorf(\"note region [%d,%d) exceeds file size %d\", noteStart, noteEnd, fi.Size())\n}","typeGuard":null,"tryCatchPattern":"p, err := core.ReadFile(exePath, corePath)\nif err != nil {\n\tif strings.Contains(err.Error(), \"reading name:\") {\n\t\tlog.Printf(\"note stream ended mid-note (%v); core likely truncated — re-dump\", err)\n\t}\n\treturn err\n}","preventionTips":["Validate cores with 'readelf -n' before analysis.","Use checksum-verified transfers for core files.","Regenerate dumps that fail mid-note reads.","Monitor disk space where the kernel writes cores."],"tags":["core-dump","elf-notes","io-error"],"backgroundTag":"truncated-core-file","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}