{"record":{"id":"3d842e3c69305c9a","repo":"go-delve/delve","slug":"malformed-proc-pid-maps-on-line-d-q-v","errorCode":null,"errorMessage":"malformed /proc/pid/maps on line %d: %q (%v)","messagePattern":"malformed /proc/pid/maps on line (.+?): %q \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/native/dump_linux.go","lineNumber":95,"sourceCode":"\t}\n\treturn r, nil\n}\n\nfunc parseSmapsHeaderLine(lineno int, in string) (start, end uint64, perm string, offset uint64, dev, filename string, err error) {\n\tfields := strings.SplitN(in, \" \", 6)\n\tif len(fields) != 6 {\n\t\terr = fmt.Errorf(\"malformed /proc/pid/maps on line %d: %q (wrong number of fields)\", lineno, in)\n\t\treturn\n\t}\n\n\tv := strings.Split(fields[0], \"-\")\n\tif len(v) != 2 {\n\t\terr = fmt.Errorf(\"malformed /proc/pid/maps on line %d: %q (bad first field)\", lineno, in)\n\t\treturn\n\t}\n\tstart, err = strconv.ParseUint(v[0], 16, 64)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"malformed /proc/pid/maps on line %d: %q (%v)\", lineno, in, err)\n\t\treturn\n\t}\n\tend, err = strconv.ParseUint(v[1], 16, 64)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"malformed /proc/pid/maps on line %d: %q (%v)\", lineno, in, err)\n\t\treturn\n\t}\n\n\tperm = fields[1]\n\tif len(perm) < 4 {\n\t\terr = fmt.Errorf(\"malformed /proc/pid/maps on line %d: %q (permissions column too short)\", lineno, in)\n\t\treturn\n\t}\n\n\toffset, err = strconv.ParseUint(fields[2], 16, 64)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"malformed /proc/pid/maps on line %d: %q (%v)\", lineno, in, err)\n\t\treturn","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/native/dump_linux.go#L77-L113","documentation":"The low hex address of the mapping's 'start-end' field failed strconv.ParseUint(v[0], 16, 64). The maps line's start address is not valid 64-bit hex, so the line is rejected as malformed.","triggerScenarios":"parseSmapsHeaderLine given a line whose first sub-field before '-' is not parseable hex — corrupted maps content, leading garbage/whitespace/BOM, or a spliced line from a torn read.","commonSituations":"Reading /proc through a translator (containers, FUSE) that mangles hex; file read race producing partial lines; binary junk prepended to the file.","solutions":["Re-read /proc/<pid>/maps fully and retry; a partial line usually disappears.","Ensure the reader strips whitespace/CR/BOM from each line before parsing.","Verify no external process is rewriting the maps file being read.","If persistent, capture the raw line and compare against `cat /proc/<pid>/maps` to identify the mangling layer."],"exampleFix":"// before\nline := scanner.Text()  // may contain trailing \\r on some systems\n// after\nline := strings.TrimSpace(scanner.Text())","handlingStrategy":"validation","validationCode":"start, err := strconv.ParseUint(strings.SplitN(line, \"-\", 2)[0], 16, 64)\nif err != nil { return fmt.Errorf(\"invalid start addr in line %q: %w\", line, err) }","typeGuard":"func validHexAddr(s string) bool {\n    _, err := strconv.ParseUint(s, 16, 64); return err == nil && len(s) > 0\n}","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"malformed /proc\") {\n    raw, _ := os.ReadFile(fmt.Sprintf(\"/proc/%d/maps\", pid))\n    return retryParse(strings.Split(string(raw), \"\\n\"))\n}","preventionTips":["Trim whitespace/CR/BOM from each line before parsing.","Re-read the file atomically; transient partial lines cause spurious failures.","Validate all lines against a strict regex before feeding the parser.","Compare failing lines against raw /proc output to spot translator mangling."],"tags":["linux","procfs","core-dump","delve"],"backgroundTag":"malformed-proc-maps-line","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}