{"record":{"id":"b606f56222ba006c","repo":"golang/go","slug":"preprocessed-profile-error-processing-call-line","errorCode":null,"errorMessage":"preprocessed profile error processing call line: %w","messagePattern":"preprocessed profile error processing call line: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/pgo/deserialize.go","lineNumber":77,"sourceCode":"\t\tcalleeName := scanner.Text()\n\n\t\tif !scanner.Scan() {\n\t\t\tif err := scanner.Err(); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error reading preprocessed profile: %w\", err)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"preprocessed profile entry missing weight\")\n\t\t}\n\t\treadStr = scanner.Text()\n\n\t\tsplit := strings.Split(readStr, \" \")\n\n\t\tif len(split) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"preprocessed profile entry got %v want 2 fields\", split)\n\t\t}\n\n\t\tco, err := strconv.Atoi(split[0])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"preprocessed profile error processing call line: %w\", err)\n\t\t}\n\n\t\tedge := NamedCallEdge{\n\t\t\tCallerName:     callerName,\n\t\t\tCalleeName:     calleeName,\n\t\t\tCallSiteOffset: co,\n\t\t}\n\n\t\tweight, err := strconv.ParseInt(split[1], 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"preprocessed profile error processing call weight: %w\", err)\n\t\t}\n\n\t\tif _, ok := d.NamedEdgeMap.Weight[edge]; ok {\n\t\t\treturn nil, fmt.Errorf(\"preprocessed profile contains duplicate edge %+v\", edge)\n\t\t}\n\n\t\td.NamedEdgeMap.ByWeight = append(d.NamedEdgeMap.ByWeight, edge) // N.B. serialization is ordered.","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/pgo/deserialize.go#L59-L95","documentation":"Thrown when strconv.Atoi fails to parse the first field of the weight line (split[0]) as an integer. This field represents the call-site offset — the line number within the caller function where the call occurs. The %w wraps the strconv error (e.g. ErrSyntax or ErrRange).","triggerScenarios":"split[0] contains a non-numeric string, a number with leading/trailing junk, an empty string, or a value that overflows int. The line was successfully split into 2 fields but the first field is not a valid base-10 integer.","commonSituations":"Profile generated by a tool that emitted symbolic or hex offsets instead of decimal line numbers. Also happens if the serialization swapped field order (weight first, offset second) or if the offset field contains a function-relative annotation like \"+42\".","solutions":["Regenerate the profile so call-site offsets are plain decimal integers (base 10).","Verify the field order is offset-then-weight, not weight-then-offset.","Check that no non-numeric characters leaked into the offset field."],"exampleFix":"// Before (broken): \"0x2a 1000\"  (hex offset)\n// After (fixed):  \"42 1000\"     (decimal offset)","handlingStrategy":"validation","validationCode":"// Validate that the offset field is a decimal integer:\nfunc validateOffsets(path string) error {\n    data, err := os.ReadFile(path)\n    if err != nil { return err }\n    lines := strings.Split(strings.TrimRight(string(data), \"\\n\"), \"\\n\")\n    for i := 2; i < len(lines); i += 3 {\n        fields := strings.Split(lines[i], \" \")\n        if _, err := strconv.Atoi(fields[0]); err != nil {\n            return fmt.Errorf(\"line %d: invalid offset %q: %w\", i+1, fields[0], err)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the serializer emits decimal line numbers for offsets, not hex or symbolic names.","Validate offset fields are valid integers before deserialization.","Keep field order consistent: offset first, weight second."],"tags":["pgo","deserialization","parse-error","strconv","go-compiler-internal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}