go-delve/delve · error
malformed delve header note (bad pid): %v
Error message
malformed delve header note (bad pid): %v
What it means
threadsFromDelveNotes reads the delve header note line-by-line; the line beginning with DelveHeaderTargetPidPrefix must be a decimal number for strconv.ParseUint to succeed. A non-numeric PID value causes this error, aborting core parsing.
Source
Thrown at pkg/proc/core/delve_core.go:47
func threadsFromDelveNotes(p *process, notes []*note) (proc.Thread, error) {
var currentThread proc.Thread
for _, note := range notes {
if note.Type == elfwriter.DelveHeaderNoteType {
buf := bytes.NewBuffer(note.Desc.([]byte))
for {
line, err := buf.ReadString('\n')
if err != nil {
break
}
if len(line) > 0 && line[len(line)-1] == '\n' {
line = line[:len(line)-1]
}
switch {
case strings.HasPrefix(line, elfwriter.DelveHeaderTargetPidPrefix):
pid, err := strconv.ParseUint(line[len(elfwriter.DelveHeaderTargetPidPrefix):], 10, 64)
if err != nil {
return nil, fmt.Errorf("malformed delve header note (bad pid): %v", err)
}
p.pid = int(pid)
case strings.HasPrefix(line, elfwriter.DelveHeaderEntryPointPrefix):
entry, err := strconv.ParseUint(line[len(elfwriter.DelveHeaderEntryPointPrefix):], 0, 64)
if err != nil {
return nil, fmt.Errorf("malformed delve header note (bad entry point): %v", err)
}
p.entryPoint = entry
}
}
}
if note.Type != elfwriter.DelveThreadNodeType {
continue
}
body := bytes.NewReader(note.Desc.([]byte))
th := new(delveThread)
th.regs = new(delveRegisters)View on GitHub (pinned to a23773e6c3)
Solutions
- Fix the header note so the PID line is a plain decimal number, e.g. 'pid: 12345'.
- Regenerate the core dump with delve rather than editing the note manually.
- Verify the note payload was not truncated (check Descsz vs actual bytes).
- Confirm the producing tool's delve version matches the reading version's note format.
Example fix
// before "pid: 0x3039" // hex not accepted // after "pid: 12345" // decimal only
Defensive patterns
Strategy: validation
Validate before calling
// Validate PID line before parsing
pidStr := strings.TrimPrefix(line, DelveHeaderTargetPidPrefix)
if _, err := strconv.ParseUint(pidStr, 10, 64); err != nil {
return fmt.Errorf("core note pid %q is not decimal", pidStr)
} Type guard
func isDecimal(s string) bool {
_, err := strconv.ParseUint(s, 10, 64)
return err == nil
} Prevention
- Emit the pid as plain decimal in note-producing tools.
- Avoid manual edits to core notes.
- Check note payload completeness after writing.
- Pin delve versions across dump/analyze workflows.
When it happens
Trigger: readLinuxOrPlatformIndependentCore -> threadsFromDelveNotes encounters a header-note line like 'pid: abc' or an empty value after the PID prefix, so ParseUint(base 10, 64) fails.
Common situations: Hand-edited core notes; writing tools that emit the PID in hex (0x...) or with extra characters; truncated note payload cutting off digits.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- malformed delve header note (bad entry point): %v
- malformed delve header note: %q
- reading name: %v
- short read
- can not continue execution of core process
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/6284a6729d996c3c.
Report an issue: GitHub.