{"record":{"id":"43fe3f836712d6e7","repo":"gohugoio/hugo","slug":"paginate-configuration-setting-must-be-positive","errorCode":null,"errorMessage":"'paginate' configuration setting must be positive to paginate","messagePattern":"'paginate' configuration setting must be positive to paginate","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/page/pagination.go","lineNumber":284,"sourceCode":"\t\treturn conf.Pagination().PagerSize, nil\n\t}\n\n\tif len(options) > 1 {\n\t\treturn -1, errors.New(\"too many arguments, 'pager size' is currently the only option\")\n\t}\n\n\tpas, err := cast.ToIntE(options[0])\n\n\tif err != nil || pas <= 0 {\n\t\treturn -1, errors.New((\"'pager size' must be a positive integer\"))\n\t}\n\n\treturn pas, nil\n}\n\nfunc Paginate(td TargetPathDescriptor, seq any, pagerSize int) (*Paginator, error) {\n\tif pagerSize <= 0 {\n\t\treturn nil, errors.New(\"'paginate' configuration setting must be positive to paginate\")\n\t}\n\n\turlFactory := newPaginationURLFactory(td)\n\n\tvar paginator *Paginator\n\n\tgroups, ok, err := ToPagesGroup(seq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ok {\n\t\tpaginator, _ = newPaginatorFromPageGroups(groups, pagerSize, urlFactory)\n\t} else {\n\t\tpages, err := ToPages(seq)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpaginator, _ = newPaginatorFromPages(pages, pagerSize, urlFactory)","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/page/pagination.go#L266-L302","documentation":"`Paginate` (pagination.go:282-285) requires a positive pager size to split pages into pages. When the resolved size is <= 0 (often from a missing/zero `paginate` config setting), pagination cannot proceed and the call errors.","triggerScenarios":"Building with `paginate = 0` (or negative) in hugo.toml, or omitting `paginate` in a setup where it resolves to 0, then calling `.Paginator`/`.Paginate` in a template.","commonSituations":"Disabling pagination by setting `paginate = 0` but still calling `.Paginator`; fresh config without a `paginate` key resolving to 0; inheriting a theme that paginates while the project disabled it.","solutions":["Set `paginate` to a positive integer in hugo.toml, e.g. `paginate = 10`.","Remove the `.Paginator`/`.Paginate` call from templates if pagination is intentionally disabled.","If using `.Paginate $pages N`, pass an explicit positive N to override the config."],"exampleFix":"# before\npaginate = 0\n\n# after\npaginate = 10","handlingStrategy":"validation","validationCode":"if pagerSize <= 0 { return errors.New(\"'paginate' configuration setting must be positive to paginate\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set paginate to a positive integer in config.","Don't call .Paginator if you intentionally disabled pagination."],"tags":["hugo","configuration","pagination","templates"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}