golang/go · error
preprocessed profile error processing call line: %w
Error message
preprocessed profile error processing call line: %w
What it means
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).
Source
Thrown at src/cmd/internal/pgo/deserialize.go:77
calleeName := scanner.Text()
if !scanner.Scan() {
if err := scanner.Err(); err != nil {
return nil, fmt.Errorf("error reading preprocessed profile: %w", err)
}
return nil, fmt.Errorf("preprocessed profile entry missing weight")
}
readStr = scanner.Text()
split := strings.Split(readStr, " ")
if len(split) != 2 {
return nil, fmt.Errorf("preprocessed profile entry got %v want 2 fields", split)
}
co, err := strconv.Atoi(split[0])
if err != nil {
return nil, fmt.Errorf("preprocessed profile error processing call line: %w", err)
}
edge := NamedCallEdge{
CallerName: callerName,
CalleeName: calleeName,
CallSiteOffset: co,
}
weight, err := strconv.ParseInt(split[1], 10, 64)
if err != nil {
return nil, fmt.Errorf("preprocessed profile error processing call weight: %w", err)
}
if _, ok := d.NamedEdgeMap.Weight[edge]; ok {
return nil, fmt.Errorf("preprocessed profile contains duplicate edge %+v", edge)
}
d.NamedEdgeMap.ByWeight = append(d.NamedEdgeMap.ByWeight, edge) // N.B. serialization is ordered.View on GitHub (pinned to b6b368adc5)
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.
Example fix
// Before (broken): "0x2a 1000" (hex offset) // After (fixed): "42 1000" (decimal offset)
Defensive patterns
Strategy: validation
Validate before calling
// Validate that the offset field is a decimal integer:
func validateOffsets(path string) error {
data, err := os.ReadFile(path)
if err != nil { return err }
lines := strings.Split(strings.TrimRight(string(data), "\n"), "\n")
for i := 2; i < len(lines); i += 3 {
fields := strings.Split(lines[i], " ")
if _, err := strconv.Atoi(fields[0]); err != nil {
return fmt.Errorf("line %d: invalid offset %q: %w", i+1, fields[0], err)
}
}
return nil
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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".
Related errors
- preprocessed profile error processing call weight: %w
- preprocessed profile entry missing weight
- preprocessed profile entry got %v want 2 fields
- preprocessed profile contains duplicate edge %+v
- error parsing profile: %w
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/b606f56222ba006c.
Report an issue: GitHub.