qax-os/excelize · error

ErrCellStyles

ErrCellStyles

Error message

the cell styles exceeds the %d limit

What it means

Formatted error ErrCellStyles returned by NewStyle when the style table (CellXfs) already contains MaxCellStyles (65430) entries, the OOXML limit; the guard rejects creating one more style because Excel cannot address it.

Solutions

  1. Reuse existing styles instead of creating new ones
  2. Close and reopen the workbook to start with a fresh style table
  3. Audit for styles created in loops or per-row calls
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at errors.go:31 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of qax-os/excelize@f2483381fb (2026-09-02). Data as JSON: /api/errors/46e5cd0a19383d28. Report an issue: GitHub.

Appendix: source

Thrown at errors.go:31

import (
	"errors"
	"fmt"
	"strings"
)

var (
	// ErrAddVBAProject defined the error message on add the VBA project in
	// the workbook.
	ErrAddVBAProject = errors.New("unsupported VBA project")
	// ErrAttrValBool defined the error message on marshal and unmarshal
	// boolean type XML attribute.
	ErrAttrValBool = errors.New("unexpected child of attrValBool")
	// ErrCellCharsLength defined the error message for receiving a cell
	// characters length that exceeds the limit.
	ErrCellCharsLength = fmt.Errorf("cell value must be 0-%d characters", TotalCellChars)
	// ErrCellStyles defined the error message on cell styles exceeds the limit.
	ErrCellStyles = fmt.Errorf("the cell styles exceeds the %d limit", MaxCellStyles)
	// ErrChartTitle defined the error message on both formula and rich text for
	// chart title.
	ErrChartTitle = errors.New("cannot set both 'Formula' and 'Paragraph' for chart title")
	// ErrColumnNumber defined the error message on receive an invalid column
	// number.
	ErrColumnNumber = fmt.Errorf("the column number must be greater than or equal to %d and less than or equal to %d", MinColumns, MaxColumns)
	// ErrColumnWidth defined the error message on receive an invalid column
	// width.
	ErrColumnWidth = fmt.Errorf("the width of the column must be less than or equal to %d characters", MaxColumnWidth)
	// ErrCoordinates defined the error message on invalid coordinates tuples
	// length.
	ErrCoordinates = errors.New("coordinates length must be 4")
	// ErrCustomNumFmt defined the error message on receive the empty custom
	// number format.
	ErrCustomNumFmt = errors.New("custom number format can not be empty")
	// ErrDataValidationFormulaLength defined the error message for receiving a
	// data validation formula length that exceeds the limit.
	ErrDataValidationFormulaLength = fmt.Errorf("data validation must be 0-%d characters", MaxFieldLength)

View on GitHub (pinned to f2483381fb)