qax-os/excelize · error
chart title field %s value must be an integer from 0 to 100
Error message
chart title field %s value must be an integer from 0 to 100
What it means
newChartTitleError is returned when a chart title formatting field (such as rotation or size in ChartTitle/ChartAxis options) is outside the valid integer range 0-100. parseTitle validates these numeric fields while constructing the chart XML, since the OOXML spec restricts them to percentage-like values.
Source
Thrown at errors.go:237
return fmt.Sprintf("sheet %s does not exist", err.SheetName)
}
// newAddCommentError defined the error message on the comment already exist in
// the cell.
func newAddCommentError(cell string) error {
return fmt.Errorf("comment already exist on cell %s", cell)
}
// newCellNameToCoordinatesError defined the error message on converts
// alphanumeric cell name to coordinates.
func newCellNameToCoordinatesError(cell string, err error) error {
return fmt.Errorf("cannot convert cell %q to coordinates: %v", cell, err)
}
// newChartTitleError defined the error message on receiving the invalid chart
// title parameters.
func newChartTitleError(name string) error {
return fmt.Errorf("chart title field %s value must be an integer from 0 to 100", name)
}
// newCoordinatesToCellNameError defined the error message on converts [X, Y]
// coordinates to alpha-numeric cell name.
func newCoordinatesToCellNameError(col, row int) error {
return fmt.Errorf("invalid cell reference [%d, %d]", col, row)
}
// newFieldLengthError defined the error message on receiving the field length
// overflow.
func newFieldLengthError(name string) error {
return fmt.Errorf("field %s must be less than or equal to 255 characters", name)
}
// newInvalidAutoFilterColumnError defined the error message on receiving the
// incorrect index of column.
func newInvalidAutoFilterColumnError(col string) error {
return fmt.Errorf("incorrect index of column %q", col)View on GitHub (pinned to f2483381fb)
Solutions
- Clamp the value into [0, 100] before building chart options
- Convert units if you intended degrees (rotate = degrees, but validate 0-100 fields separately)
- Add input validation in your UI/config layer so out-of-range values never reach AddChart
Example fix
// before
opts.Rotation = rotationDegrees // e.g. 270
f.AddChart("Sheet1", "A1", opts)
// after
if opts.Rotation < 0 { opts.Rotation = 0 }
if opts.Rotation > 100 { opts.Rotation = 100 }
f.AddChart("Sheet1", "A1", opts) Defensive patterns
Strategy: validation
Validate before calling
if v < 0 || v > 100 { return fmt.Errorf("title field must be 0-100") } Type guard
func in0100(v int) bool { return v >= 0 && v <= 100 } Prevention
- Clamp percentage-style title fields to [0,100] before AddChart
- Don't mix degree units (0-360) with percent fields (0-100)
- Validate chart options at the configuration/UI boundary
When it happens
Trigger: f.AddChart with options where a title field (e.g. Title override or title format field set through parseTitle) is negative or greater than 100, or a non-integer out-of-range value.
Common situations: Passing degrees or pixel sizes into percentage-style fields; computing font size/rotation from user input without bounds checking; confusion between 0-100 percent and 0-360 degree units.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- ErrTransparency
- unsupported chart type %d
- cannot set both 'Formula' and 'Paragraph' for chart title
- data validation range exceeds limit
- the same name already exists on the scope
AI-assisted analysis of qax-os/excelize@f2483381fb (2026-09-02).
Data as JSON: /api/errors/6efee2b1c87108ca.
Report an issue: GitHub.