{"record":{"id":"44b328ff17a80a49","repo":"go-delve/delve","slug":"malformed-delve-header-note-q","errorCode":null,"errorMessage":"malformed delve header note: %q","messagePattern":"malformed delve header note: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/core/delve_core.go","lineNumber":23,"sourceCode":"\t\"encoding/binary\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/go-delve/delve/pkg/dwarf/op\"\n\t\"github.com/go-delve/delve/pkg/elfwriter\"\n\t\"github.com/go-delve/delve/pkg/proc\"\n)\n\nfunc platformFromNotes(notes []*note) (goos, goarch string, err error) {\n\tfor _, note := range notes {\n\t\tif note.Type != elfwriter.DelveHeaderNoteType {\n\t\t\tcontinue\n\t\t}\n\t\tlines := strings.Split(string(note.Desc.([]byte)), \"\\n\")\n\t\tv := strings.Split(lines[0], \"/\")\n\t\tif len(v) != 2 {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"malformed delve header note: %q\", string(note.Desc.([]byte)))\n\t\t}\n\t\treturn v[0], v[1], nil\n\t}\n\tpanic(\"internal error\")\n}\n\nfunc threadsFromDelveNotes(p *process, notes []*note) (proc.Thread, error) {\n\tvar currentThread proc.Thread\n\tfor _, note := range notes {\n\t\tif note.Type == elfwriter.DelveHeaderNoteType {\n\t\t\tbuf := bytes.NewBuffer(note.Desc.([]byte))\n\t\t\tfor {\n\t\t\t\tline, err := buf.ReadString('\\n')\n\t\t\t\tif err != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif len(line) > 0 && line[len(line)-1] == '\\n' {\n\t\t\t\t\tline = line[:len(line)-1]","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/core/delve_core.go#L5-L41","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before (malformed note written by custom tool)\ndesc := []byte(\"linux amd64\") // no slash\n// after (correct delve header note format)\ndesc := []byte(\"linux/amd64\\n...\")","handlingStrategy":"validation","validationCode":"// Inspect the delve header note before loading\nparts := strings.SplitN(firstLine, \"/\", 2)\nif len(parts) != 2 || parts[0] == \"\" || parts[1] == \"\" {\n\treturn fmt.Errorf(\"note first line %q is not GOOS/GOARCH\", firstLine)\n}","typeGuard":"func isWellFormedDelveHeader(desc []byte) bool {\n\tlines := strings.Split(string(desc), \"\\n\")\n\tv := strings.Split(lines[0], \"/\")\n\treturn len(v) == 2 && v[0] != \"\" && v[1] != \"\"\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["core-dump","elf-notes","format-validation"],"backgroundTag":"malformed-core-header-note","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}