gohugoio/hugo · error
too many arguments, 'pager size' is currently the only optio
Error message
too many arguments, 'pager size' is currently the only option
What it means
Returned by ResolvePagerSize when .Paginate/.Paginator is called with more than one option argument. Hugo currently accepts only a single optional argument — the pager size — so any extra positional argument is rejected.
Source
Thrown at resources/page/pagination.go:270
key = kp.key
pg = append(pg, PageGroup{Key: key})
groupIndex++
}
pg[groupIndex].Pages = append(pg[groupIndex].Pages, kp.page)
}
split = append(split, pg)
}
return split
}
func ResolvePagerSize(conf config.AllProvider, options ...any) (int, error) {
if len(options) == 0 {
return conf.Pagination().PagerSize, nil
}
if len(options) > 1 {
return -1, errors.New("too many arguments, 'pager size' is currently the only option")
}
pas, err := cast.ToIntE(options[0])
if err != nil || pas <= 0 {
return -1, errors.New(("'pager size' must be a positive integer"))
}
return pas, nil
}
func Paginate(td TargetPathDescriptor, seq any, pagerSize int) (*Paginator, error) {
if pagerSize <= 0 {
return nil, errors.New("'paginate' configuration setting must be positive to paginate")
}
urlFactory := newPaginationURLFactory(td)
View on GitHub ↗ (pinned to 8a468df065)
Solutions
- Call .Paginate with at most one option: `{{ .Paginate .Pages 10 }}`
- Set the default pager size in site config (`pagination.pagerSize`) instead of passing arguments
- Remove the extra argument; there is no offset/start parameter
Example fix
// before
{{ $pag := .Paginate .Pages 10 20 }}
// after
{{ $pag := .Paginate .Pages 10 }} Defensive patterns
Strategy: validation
Validate before calling
{{/* correct: */}}{{ $pag := .Paginate .Pages 5 }}{{/* wrong: .Paginate .Pages 5 "extra" */}} Prevention
- Call .Paginate with at most two arguments: the collection and an optional integer page size
- Configure default page size via pagination.pagerSize in site config instead of passing it everywhere
- Audit templates after upgrades for stale multi-argument Paginate calls
When it happens
Trigger: Template calls like `{{ .Paginate .Pages 10 20 }}` or `{{ .Paginate .Pages 10 "foo" }}` — anything with two or more arguments after the page collection.
Common situations: Guessing the API and passing an offset/start-page as a second argument, porting pagination code from other frameworks, or accidental extra arguments from template refactors.
Related errors
- need at least 2 arguments to append
- must provide a Resource and optionally an options map
- operator argument must be string type
- can't evaluate the array by no match argument or more than o
- invalid arguments supplied to `time`
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/b4fcd2b992af4502.json.
Report an issue: GitHub ↗.