gohugoio/hugo · error
must not provide more arguments than Resource and hash…
Error message
must not provide more arguments than Resource and hash algorithm
What it means
Thrown by resources.Fingerprint when more than two arguments are supplied. The function accepts at most a hash algorithm and a Resource (in that order), so three or more arguments is a usage error.
Solutions
- Limit to at most two arguments: either {{ resources.Fingerprint $r }} or {{ resources.Fingerprint "sha512" $r }}.
- Remember the algorithm, if given, must be the FIRST argument.
- Fingerprint resources individually, not as a batch.
Example fix
// before
{{ resources.Fingerprint $r "sha512" $opts }}
// after
{{ resources.Fingerprint "sha512" $r }} Defensive patterns
Strategy: validation
Validate before calling
{{ resources.Fingerprint "sha512" $r }} Prevention
- Limit Fingerprint to at most two arguments.
- Remember algorithm comes first when provided.
- Fingerprint resources one at a time.
When it happens
Trigger: Calling {{ resources.Fingerprint $r "sha512" $extra }} or any form with three or more arguments. Also passing an options map or multiple resources.
Common situations: Misremembering the argument order and adding extras; copy-paste from another resources function that takes more args; passing a slice of resources.
Related errors
- must provide a Resource object
- must provide an URL and optionally an options map
- must provide a Resource and optionally an options map
- must provide one or more Resource objects to concat
- resources.PostProcess cannot be used in a deferred template
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/490244e80710e3e0.
Report an issue: GitHub.
Appendix: source
Thrown at tpl/resources/resources.go:270
data := args[1]
r, ok := args[2].(resources.ResourceTransformer)
if !ok {
return nil, fmt.Errorf("type %T not supported in Resource transformations", args[2])
}
return ns.templatesClient.ExecuteAsTemplate(ctx, r, targetPath, data)
}
// Fingerprint transforms the given Resource with a MD5 hash of the content in
// the RelPermalink and Permalink.
func (ns *Namespace) Fingerprint(args ...any) (resource.Resource, error) {
if len(args) < 1 {
return nil, errors.New("must provide a Resource object")
}
if len(args) > 2 {
return nil, errors.New("must not provide more arguments than Resource and hash algorithm")
}
var algo string
resIdx := 0
if len(args) == 2 {
resIdx = 1
var err error
algo, err = cast.ToStringE(args[0])
if err != nil {
return nil, err
}
}
r, ok := args[resIdx].(resources.ResourceTransformer)
if !ok {
return nil, fmt.Errorf("%T can not be transformed", args[resIdx])
}View on GitHub (pinned to 52c9bd7908)