go-delve/delve · error
malformed delve header note: %q
Error message
malformed delve header note: %q
What it means
platformFromNotes parses the Delve header note embedded in a core dump, whose first line must be '<OS>/<arch>'. If the note type matches but the first line does not split into exactly two slash-separated parts, the note is considered malformed and this error is thrown instead of guessing the platform.
Source
Thrown at pkg/proc/core/delve_core.go:23
"encoding/binary"
"fmt"
"strconv"
"strings"
"github.com/go-delve/delve/pkg/dwarf/op"
"github.com/go-delve/delve/pkg/elfwriter"
"github.com/go-delve/delve/pkg/proc"
)
func platformFromNotes(notes []*note) (goos, goarch string, err error) {
for _, note := range notes {
if note.Type != elfwriter.DelveHeaderNoteType {
continue
}
lines := strings.Split(string(note.Desc.([]byte)), "\n")
v := strings.Split(lines[0], "/")
if len(v) != 2 {
return "", "", fmt.Errorf("malformed delve header note: %q", string(note.Desc.([]byte)))
}
return v[0], v[1], nil
}
panic("internal error")
}
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]View on GitHub (pinned to a23773e6c3)
Solutions
- Regenerate the core dump with an unmodified, matching version of delve (dlv core / dlv debug with core support).
- Verify the note payload: the first line must be exactly 'GOOS/GOARCH', e.g. 'linux/amd64'.
- Check for file truncation or corruption by comparing the core file size against the original.
- If the core came from another tool, open it with the tool-appropriate debugger instead of delve.
Example fix
// before (malformed note written by custom tool)
desc := []byte("linux amd64") // no slash
// after (correct delve header note format)
desc := []byte("linux/amd64\n...") Defensive patterns
Strategy: validation
Validate before calling
// Inspect the delve header note before loading
parts := strings.SplitN(firstLine, "/", 2)
if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
return fmt.Errorf("note first line %q is not GOOS/GOARCH", firstLine)
} Type guard
func isWellFormedDelveHeader(desc []byte) bool {
lines := strings.Split(string(desc), "\n")
v := strings.Split(lines[0], "/")
return len(v) == 2 && v[0] != "" && v[1] != ""
} Prevention
- Only consume core files written by a matching delve version.
- Never hand-edit note payloads.
- Verify file integrity (size/checksum) after transferring cores.
- Pre-flight with 'file' and 'readelf -n' before loading.
When it happens
Trigger: Calling readLinuxOrPlatformIndependentCore on a core file that contains a note with type elfwriter.DelveHeaderNoteType whose Desc payload's first line is not of the form 'linux/amd64' (e.g. no slash, or more than one slash).
Common situations: Core files produced by modified, hand-edited, or third-party tools that imitate the delve header note; truncated or corrupted note payloads; files written by a different delve version with a changed header format.
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 pid): %v
- malformed delve header note (bad entry point): %v
- 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/44b328ff17a80a49.
Report an issue: GitHub.