{"record":{"id":"ecb2d4ccafa3c84c","repo":"qax-os/excelize","slug":"errparameterinvalid","errorCode":"ErrParameterInvalid","errorMessage":"parameter is invalid","messagePattern":"parameter is invalid","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":123,"sourceCode":"\tErrNameLength = fmt.Errorf(\"the name length exceeds the %d characters limit\", MaxFieldLength)\n\t// ErrMaxGraphicAltTextLength defined the error message on receiving the\n\t// graphic alt text length exceeds the limit.\n\tErrMaxGraphicAltTextLength = fmt.Errorf(\"the alt text length exceeds the %d characters limit\", MaxGraphicAltTextLength)\n\t// ErrMaxGraphicNameLength defined the error message on receiving the\n\t// graphic name length exceeds the limit.\n\tErrMaxGraphicNameLength = fmt.Errorf(\"the name length exceeds the %d characters limit\", MaxGraphicNameLength)\n\t// ErrOptionsUnzipSizeLimit defined the error message for receiving\n\t// invalid UnzipSizeLimit and UnzipXMLSizeLimit.\n\tErrOptionsUnzipSizeLimit = errors.New(\"the value of UnzipSizeLimit should be greater than or equal to UnzipXMLSizeLimit\")\n\t// ErrOutlineLevel defined the error message on receive an invalid outline\n\t// level number.\n\tErrOutlineLevel = errors.New(\"invalid outline level\")\n\t// ErrPageSetupAdjustTo defined the error message for receiving a page setup\n\t// adjust to value exceeds limit.\n\tErrPageSetupAdjustTo = errors.New(\"adjust to value must be an integer from 0 to 400\")\n\t// ErrParameterInvalid defined the error message on receive the invalid\n\t// parameter.\n\tErrParameterInvalid = errors.New(\"parameter is invalid\")\n\t// ErrParameterRequired defined the error message on receive the empty\n\t// parameter.\n\tErrParameterRequired = errors.New(\"parameter is required\")\n\t// ErrPasswordLengthInvalid defined the error message on invalid password\n\t// length.\n\tErrPasswordLengthInvalid = errors.New(\"password length invalid\")\n\t// ErrPivotTableShowValuesAsBaseField defined the error message on enable\n\t// this kind of \"show values as\" type requires a base field.\n\tErrPivotTableShowValuesAsBaseField = errors.New(\"this kind of show values as type requires a base field\")\n\t// ErrPivotTableShowValuesAsBaseItem defined the error message on enable\n\t// this kind of \"show values as\" type and base field requires a base item.\n\tErrPivotTableShowValuesAsBaseItem = errors.New(\"this kind of show values as type and base field requires a base item\")\n\t// ErrPivotTableClassicLayout defined the error message on enable\n\t// ClassicLayout and CompactData in the same time.\n\tErrPivotTableClassicLayout = errors.New(\"cannot enable ClassicLayout and CompactData in the same time\")\n\t// ErrSave defined the error message for saving file.\n\tErrSave = errors.New(\"no path defined for file, consider File.WriteTo or File.Write\")\n\t// ErrSheetIdx defined the error message on receive the invalid worksheet","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L105-L141","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nf.Pkg.Store(\"xl/tables/table1.xml\", []byte(`<table ref=\"-\" />`))\n// after\nf.Pkg.Store(\"xl/tables/table1.xml\", []byte(`<table ref=\"A1:E5\" />`))","handlingStrategy":"validation","validationCode":"func validRangeRef(s string) bool {\n    _, err := reference.RangeRef(s)\n    return err == nil && s != \"\" && !strings.ContainsAny(s, \"-\")\n}","typeGuard":"var _ *excelize.PivotTableOptions // ensure option structs are non-nil and fields populated before API calls","tryCatchPattern":"if err := f.RemoveRow(sheet, 1); errors.Is(err, excelize.ErrParameterInvalid) { // inspect the parameter/XML part that is malformed }","preventionTips":["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"],"tags":["go","excelize","parameter-validation","formula"],"backgroundTag":"invalid-parameter","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}