{"record":{"id":"490244e80710e3e0","repo":"gohugoio/hugo","slug":"must-not-provide-more-arguments-than-resource-and","errorCode":null,"errorMessage":"must not provide more arguments than Resource and hash algorithm","messagePattern":"must not provide more arguments than Resource and hash algorithm","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/resources/resources.go","lineNumber":270,"sourceCode":"\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\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}","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/resources/resources.go#L252-L288","documentation":"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.","triggerScenarios":"Calling {{ resources.Fingerprint $r \"sha512\" $extra }} or any form with three or more arguments. Also passing an options map or multiple resources.","commonSituations":"Misremembering the argument order and adding extras; copy-paste from another resources function that takes more args; passing a slice of resources.","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."],"exampleFix":"// before\n{{ resources.Fingerprint $r \"sha512\" $opts }}\n// after\n{{ resources.Fingerprint \"sha512\" $r }}","handlingStrategy":"validation","validationCode":"{{ resources.Fingerprint \"sha512\" $r }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Limit Fingerprint to at most two arguments.","Remember algorithm comes first when provided.","Fingerprint resources one at a time."],"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"}