{"record":{"id":"1fe567296a8b5840","repo":"qax-os/excelize","slug":"the-value-of-unzipsizelimit-should-be-greater-than","errorCode":null,"errorMessage":"the value of UnzipSizeLimit should be greater than or equal to UnzipXMLSizeLimit","messagePattern":"the value of UnzipSizeLimit should be greater than or equal to UnzipXMLSizeLimit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":114,"sourceCode":"\tErrMaxFilePathLength = fmt.Errorf(\"file path length exceeds maximum limit %d characters\", MaxFilePathLength)\n\t// ErrMaxRowHeight defined the error message on receive an invalid row\n\t// height.\n\tErrMaxRowHeight = fmt.Errorf(\"the height of the row must be less than or equal to %d points\", MaxRowHeight)\n\t// ErrMaxRows defined the error message on receive a row number exceeds\n\t// maximum limit.\n\tErrMaxRows = errors.New(\"row number exceeds maximum limit\")\n\t// ErrNameLength defined the error message on receiving the defined name or\n\t// table name length exceeds the limit.\n\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\")","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L96-L132","documentation":"ErrOptionsUnzipSizeLimit is returned by option validation when opening a workbook if Options.UnzipXMLSizeLimit exceeds Options.UnzipSizeLimit. The per-file uncompressed XML size limit logically cannot be larger than the overall uncompressed size limit.","triggerScenarios":"OpenReader/OpenFile with Options{UnzipSizeLimit: 1, UnzipXMLSizeLimit: 2}, or any configuration where UnzipXMLSizeLimit > UnzipSizeLimit; the check runs in checkOpenReaderOptions.","commonSituations":"Tuning size limits independently and setting the XML limit higher than the total limit, misreading which limit is the total versus per-file cap, or copying example configs with inconsistent values.","solutions":["Set UnzipXMLSizeLimit to a value less than or equal to UnzipSizeLimit (default XML limit is 16MB, total 2GB).","If you need a larger per-XML limit, raise UnzipSizeLimit accordingly (UnzipSizeLimit >= UnzipXMLSizeLimit).","Validate the relationship between the two options in your config-loading code before opening files."],"exampleFix":"// before\nopts := Options{UnzipSizeLimit: 1, UnzipXMLSizeLimit: 2}\n// after\nopts := Options{UnzipSizeLimit: 2048, UnzipXMLSizeLimit: 1024}","handlingStrategy":"validation","validationCode":"if opts.UnzipXMLSizeLimit > opts.UnzipSizeLimit {\n    return errors.New(\"UnzipXMLSizeLimit must be <= UnzipSizeLimit\")\n}","typeGuard":"func optionsValid(o excelize.Options) bool {\n    return o.UnzipXMLSizeLimit <= o.UnzipSizeLimit\n}","tryCatchPattern":"f, err := excelize.OpenReader(r, opts)\nif errors.Is(err, excelize.ErrOptionsUnzipSizeLimit) {\n    opts.UnzipSizeLimit = opts.UnzipXMLSizeLimit\n    f, err = excelize.OpenReader(r, opts)\n}","preventionTips":["Set both limits together in a single config helper that enforces UnzipXMLSizeLimit <= UnzipSizeLimit.","When raising the XML limit, raise the total limit first.","Validate options loaded from config files before constructing excelize.Options.","Keep the documented defaults (2GB total / 16MB XML) unless you have a specific need."],"tags":["go","excelize","options","configuration","validation"],"backgroundTag":"invalid-option-combination","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}