{"record":{"id":"6e2c668e3cf167f9","repo":"golang/go","slug":"preprocessed-profile-error-processing-call-weight","errorCode":null,"errorMessage":"preprocessed profile error processing call weight: %w","messagePattern":"preprocessed profile error processing call weight: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/pgo/deserialize.go","lineNumber":88,"sourceCode":"\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.\n\t\td.NamedEdgeMap.Weight[edge] += weight\n\t\td.TotalWeight += weight\n\t}\n\n\treturn d, nil\n\n}\n","sourceCodeStart":70,"sourceCodeEnd":103,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/pgo/deserialize.go#L70-L103","documentation":"Thrown when strconv.ParseInt fails to parse the second field of the weight line (split[1]) as a 64-bit signed integer. This field represents the edge weight (sample count or CPU nanoseconds). The %w wraps the strconv error. ParseInt is called with base 10 and bitSize 64.","triggerScenarios":"split[1] is not a valid base-10 signed 64-bit integer. This could be a non-numeric string, an empty string, a floating-point representation, or a value that overflows int64.","commonSituations":"Profile serialized with floating-point or scientific-notation weights (e.g. \"1.5e6\"), weights exceeding int64 range, or a format mismatch where the weight field contains a unit suffix or other annotation.","solutions":["Regenerate the profile so weights are plain base-10 64-bit integers.","If weights are very large, confirm they fit within int64 range (max ~9.2e18).","Check that no decimal points, units, or scientific notation appear in the weight field."],"exampleFix":"// Before (broken): \"42 1.5e6\"    (scientific notation)\n// After (fixed):  \"42 1500000\"  (plain integer)","handlingStrategy":"validation","validationCode":"// Validate that the weight field is a valid int64:\nfunc validateWeights(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.ParseInt(fields[1], 10, 64); err != nil {\n            return fmt.Errorf(\"line %d: invalid weight %q: %w\", i+1, fields[1], err)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the serializer emits plain base-10 integers for weights.","Check that weights fit within int64 range before serialization.","Validate weight fields before deserialization."],"tags":["pgo","deserialization","parse-error","strconv","go-compiler-internal"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}