{"record":{"id":"259a8b2f316a6fdc","repo":"gohugoio/hugo","slug":"must-provide-a-resource-object","errorCode":null,"errorMessage":"must provide a Resource object","messagePattern":"must provide a Resource object","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/resources/resources.go","lineNumber":266,"sourceCode":"\ttargetPath, err := cast.ToStringE(args[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := args[1]\n\n\tr, ok := args[2].(resources.ResourceTransformer)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"type %T not supported in Resource transformations\", args[2])\n\t}\n\n\treturn ns.templatesClient.ExecuteAsTemplate(ctx, r, targetPath, data)\n}\n\n// Fingerprint transforms the given Resource with a MD5 hash of the content in\n// the RelPermalink and Permalink.\nfunc (ns *Namespace) Fingerprint(args ...any) (resource.Resource, error) {\n\tif len(args) < 1 {\n\t\treturn nil, errors.New(\"must provide a Resource object\")\n\t}\n\n\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","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/resources/resources.go#L248-L284","documentation":"Thrown by resources.Fingerprint when called with no arguments. Fingerprint requires at least a Resource object (and optionally a hash algorithm string as the first argument). Calling {{ resources.Fingerprint }} with nothing triggers this.","triggerScenarios":"Calling {{ resources.Fingerprint }} directly, or piping nothing into it: {{ $nil | resources.Fingerprint }}.","commonSituations":"Forgetting to pass the resource; piping a nil resource variable; refactoring that dropped the argument.","solutions":["Pass a resource: {{ $r | resources.Fingerprint }} or {{ resources.Fingerprint $r }}.","Optionally pass an algorithm first: {{ resources.Fingerprint \"sha512\" $r }}.","Ensure the resource variable is non-nil before calling."],"exampleFix":"// before\n{{ resources.Fingerprint }}\n// after\n{{ $css | resources.Fingerprint }}","handlingStrategy":"validation","validationCode":"{{ with $r }}{{ resources.Fingerprint . }}{{ end }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a resource to Fingerprint.","Guard nil resources with {{ with }}.","Optionally pass an algorithm as the first arg, resource as second."],"tags":["template","resources","arguments","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}