gohugoio/hugo · error
%T can not be transformed
Error message
%T can not be transformed
What it means
Thrown by resources.Fingerprint when the argument at position resIdx does not implement resources.ResourceTransformer. Fingerprint must read and rewrite the resource content, so it requires a transformable resource.
Solutions
- Pass a Resource from resources.Get/Match/FromString/GetRemote as the resource argument.
- In the 2-arg form ensure order is algorithm-first then resource: resources.Fingerprint "sha256" $r.
- If using .RelPermalink strings, switch to the underlying Resource object.
- Check %T in the message to confirm the type.
Example fix
// before (passed a permalink string):
{{ $fp := resources.Fingerprint .RelPermalink }}
// after (pass the Resource):
{{ $fp := resources.Fingerprint .Resources.Match "app.css" }} Defensive patterns
Strategy: type-guard
Validate before calling
{{ $r := resources.Get "app.css" }}
{{ if $r }}{{ resources.Fingerprint $r }}{{ end }} Type guard
// In Go: assert the resource supports transformation.
if _, ok := arg.(resources.ResourceTransformer); !ok { /* reject */ } Prevention
- Pass a Resource object, not a permalink string.
- In 2-arg form keep order: algorithm first, then resource.
- Confirm resources.Get returned non-nil before fingerprinting.
When it happens
Trigger: Calling {{ resources.Fingerprint $v }} or {{ resources.Fingerprint "sha256" $v }} where $v is not a ResourceTransformer (e.g. a string, a page, a non-transformable resource). The assertion args[resIdx].(resources.ResourceTransformer) fails.
Common situations: Passing a plain string or .Permalink instead of a Resource, passing a read-only/external resource that does not support transformation, or misordering the (algorithm, resource) pair in the 2-arg form.
Related errors
- type %T not supported in Resource transformations
- expected slice of Resource objects, received %T instead
- arguments must be slices or arrays
- arguments to complement must be slices or arrays
- arguments to symdiff must be slices or arrays
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/092bd6b9b4dde834.
Report an issue: GitHub.
Appendix: source
Thrown at tpl/resources/resources.go:287
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])
}
return ns.integrityClient.Fingerprint(r, algo)
}
// Minify minifies the given Resource using the MediaType to pick the correct
// minifier.
func (ns *Namespace) Minify(r resources.ResourceTransformer) (resource.Resource, error) {
return ns.minifyClient.Minify(r)
}
// PostProcess processes r after the build.
//
// Deprecated: Use templates.Defer instead.
func (ns *Namespace) PostProcess(r resource.Resource) (postpub.PostPublishedResource, error) {
hugo.DeprecateWithLogger("resources.PostProcess", "Use templates.Defer instead. See https://gohugo.io/functions/templates/defer/", "v0.164.0", ns.deps.Log.Logger())
return ns.deps.ResourceSpec.PostProcess(r)
}View on GitHub (pinned to 52c9bd7908)