{"record":{"id":"092bd6b9b4dde834","repo":"gohugoio/hugo","slug":"t-can-not-be-transformed","errorCode":null,"errorMessage":"%T can not be transformed","messagePattern":"%T can not be transformed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/resources/resources.go","lineNumber":287,"sourceCode":"\tif len(args) > 2 {\n\t\treturn nil, errors.New(\"must not provide more arguments than Resource and hash algorithm\")\n\t}\n\n\tvar algo string\n\tresIdx := 0\n\n\tif len(args) == 2 {\n\t\tresIdx = 1\n\t\tvar err error\n\t\talgo, err = cast.ToStringE(args[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tr, ok := args[resIdx].(resources.ResourceTransformer)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"%T can not be transformed\", args[resIdx])\n\t}\n\n\treturn ns.integrityClient.Fingerprint(r, algo)\n}\n\n// Minify minifies the given Resource using the MediaType to pick the correct\n// minifier.\nfunc (ns *Namespace) Minify(r resources.ResourceTransformer) (resource.Resource, error) {\n\treturn ns.minifyClient.Minify(r)\n}\n\n// PostProcess processes r after the build.\n//\n// Deprecated: Use templates.Defer instead.\nfunc (ns *Namespace) PostProcess(r resource.Resource) (postpub.PostPublishedResource, error) {\n\thugo.DeprecateWithLogger(\"resources.PostProcess\", \"Use templates.Defer instead. See https://gohugo.io/functions/templates/defer/\", \"v0.164.0\", ns.deps.Log.Logger())\n\treturn ns.deps.ResourceSpec.PostProcess(r)\n}","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/resources/resources.go#L269-L305","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (passed a permalink string):\n{{ $fp := resources.Fingerprint .RelPermalink }}\n// after (pass the Resource):\n{{ $fp := resources.Fingerprint .Resources.Match \"app.css\" }}","handlingStrategy":"type-guard","validationCode":"{{ $r := resources.Get \"app.css\" }}\n{{ if $r }}{{ resources.Fingerprint $r }}{{ end }}","typeGuard":"// In Go: assert the resource supports transformation.\nif _, ok := arg.(resources.ResourceTransformer); !ok { /* reject */ }","tryCatchPattern":null,"preventionTips":["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."],"tags":["resources","fingerprint","type-error","resource-transformer"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}