{"record":{"id":"5b76395b7dc2a101","repo":"qax-os/excelize","slug":"erroutlinelevel","errorCode":"ErrOutlineLevel","errorMessage":"invalid outline level","messagePattern":"invalid outline level","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":117,"sourceCode":"\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\")\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\")","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L99-L135","documentation":"ErrOutlineLevel is returned when an outline (grouping) level outside the valid range 1-7 is passed to SetColOutlineLevel or SetRowOutlineLevel. Excel only supports 7 outline levels per sheet, so level 0 or any value above 7 is rejected.","triggerScenarios":"Calling File.SetColOutlineLevel(sheet, col, level) or File.SetRowOutlineLevel(sheet, row, level) with level == 0 or level > 7 (e.g. SetColOutlineLevel(\"Sheet1\",\"D\",8)); also hit internally by marshalAttrs when serializing invalid outline attributes.","commonSituations":"Looping over computed nesting depths (e.g. depth from a tree algorithm) that can exceed 7; off-by-one loops like for i := 0; i <= 7; i++ that pass 0 or 8; porting data from other formats with deeper grouping.","solutions":["Clamp or validate the outline level to 1..7 before calling the setter","Skip calls with an out-of-range level instead of passing it","Merge deep grouping hierarchies to at most 7 levels"],"exampleFix":"// before\nf.SetRowOutlineLevel(\"Sheet1\", i+1, uint8(depth)) // depth can be 8+\n// after\nif depth >= 1 && depth <= 7 {\n    if err := f.SetRowOutlineLevel(\"Sheet1\", i+1, uint8(depth)); err != nil { return err }\n}","handlingStrategy":"validation","validationCode":"func validOutlineLevel(l uint8) bool { return l >= 1 && l <= 7 }\nif validOutlineLevel(level) { err := f.SetColOutlineLevel(sheet, col, level) }","typeGuard":"func validOutlineLevel(l uint8) bool { return l >= 1 && l <= 7 }","tryCatchPattern":null,"preventionTips":["Clamp computed depths to 1..7 before calling outline setters","Skip level 0 (no grouping) instead of passing it","Remember Excel caps outline depth at 7 levels"],"tags":["go","excelize","outline","parameter-validation"],"backgroundTag":"invalid-outline-level","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}