qax-os/excelize · error
ErrParameterInvalid
ErrParameterInvalid
Error message
parameter is invalid
What it means
ErrParameterInvalid is the generic excelize error for a syntactically or semantically invalid parameter, e.g. a malformed table range reference or a date-formula year outside 0-9999/1900-9999 rules. It is returned by many unrelated APIs (chart parsing, table adjusting, CALC engine date functions), so the call site matters when diagnosing.
Source
Thrown at errors.go:123
ErrNameLength = fmt.Errorf("the name length exceeds the %d characters limit", MaxFieldLength)
// ErrMaxGraphicAltTextLength defined the error message on receiving the
// graphic alt text length exceeds the limit.
ErrMaxGraphicAltTextLength = fmt.Errorf("the alt text length exceeds the %d characters limit", MaxGraphicAltTextLength)
// ErrMaxGraphicNameLength defined the error message on receiving the
// graphic name length exceeds the limit.
ErrMaxGraphicNameLength = fmt.Errorf("the name length exceeds the %d characters limit", MaxGraphicNameLength)
// ErrOptionsUnzipSizeLimit defined the error message for receiving
// invalid UnzipSizeLimit and UnzipXMLSizeLimit.
ErrOptionsUnzipSizeLimit = errors.New("the value of UnzipSizeLimit should be greater than or equal to UnzipXMLSizeLimit")
// ErrOutlineLevel defined the error message on receive an invalid outline
// level number.
ErrOutlineLevel = errors.New("invalid outline level")
// ErrPageSetupAdjustTo defined the error message for receiving a page setup
// adjust to value exceeds limit.
ErrPageSetupAdjustTo = errors.New("adjust to value must be an integer from 0 to 400")
// ErrParameterInvalid defined the error message on receive the invalid
// parameter.
ErrParameterInvalid = errors.New("parameter is invalid")
// ErrParameterRequired defined the error message on receive the empty
// parameter.
ErrParameterRequired = errors.New("parameter is required")
// ErrPasswordLengthInvalid defined the error message on invalid password
// length.
ErrPasswordLengthInvalid = errors.New("password length invalid")
// ErrPivotTableShowValuesAsBaseField defined the error message on enable
// this kind of "show values as" type requires a base field.
ErrPivotTableShowValuesAsBaseField = errors.New("this kind of show values as type requires a base field")
// ErrPivotTableShowValuesAsBaseItem defined the error message on enable
// this kind of "show values as" type and base field requires a base item.
ErrPivotTableShowValuesAsBaseItem = errors.New("this kind of show values as type and base field requires a base item")
// ErrPivotTableClassicLayout defined the error message on enable
// ClassicLayout and CompactData in the same time.
ErrPivotTableClassicLayout = errors.New("cannot enable ClassicLayout and CompactData in the same time")
// ErrSave defined the error message for saving file.
ErrSave = errors.New("no path defined for file, consider File.WriteTo or File.Write")
// ErrSheetIdx defined the error message on receive the invalid worksheetView on GitHub (pinned to f2483381fb)
Solutions
- Log/print the exact API call and parameter that returned the error to identify which parameter is invalid
- Validate range references (must be like "Sheet1!A1:E5" or "A1:E5") before passing them
- For formulas, ensure year is 1900-9999 (or 0-99 for legacy two-digit years)
- Regenerate or fix corrupted XML parts instead of hand-editing them
Example fix
// before
f.Pkg.Store("xl/tables/table1.xml", []byte(`<table ref="-" />`))
// after
f.Pkg.Store("xl/tables/table1.xml", []byte(`<table ref="A1:E5" />`)) Defensive patterns
Strategy: validation
Validate before calling
func validRangeRef(s string) bool {
_, err := reference.RangeRef(s)
return err == nil && s != "" && !strings.ContainsAny(s, "-")
} Type guard
var _ *excelize.PivotTableOptions // ensure option structs are non-nil and fields populated before API calls
Try / catch
if err := f.RemoveRow(sheet, 1); errors.Is(err, excelize.ErrParameterInvalid) { // inspect the parameter/XML part that is malformed } Prevention
- Validate all range/reference strings before passing them into excelize APIs
- Never hand-edit or template XML parts stored in f.Pkg without validating output
- For date formulas, keep years within 1900-9999 (or 0-99)
- Log which API call returned ErrParameterInvalid since it is generic
When it happens
Trigger: f.RemoveRow/adjust with a corrupted xl/tables/table1.xml like `<table ref="-" />`; chart options with invalid ranges; DATEVALUE-style formula parsing where year < 0, year > 9999, or 99 < year < 1900 (calc.go:12560); AddChart with malformed options.
Common situations: Hand-editing or templating XML parts stored in f.Pkg; building range strings like "-" or "Sheet1!" from variables; spreadsheet formulas computing dates with two-digit or negative years.
Related errors
AI-assisted analysis of qax-os/excelize@f2483381fb (2026-09-02).
Data as JSON: /api/errors/ecb2d4ccafa3c84c.
Report an issue: GitHub.