{"record":{"id":"8186449286300458","repo":"gohugoio/hugo","slug":"must-provide-an-url-and-optionally-an-options-map","errorCode":null,"errorMessage":"must provide an URL and optionally an options map","messagePattern":"must provide an URL and optionally an options map","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/resources/resources.go","lineNumber":116,"sourceCode":"\tr, err := ns.createClient.Get(filenamestr)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn r\n}\n\n// GetRemote gets the URL (via HTTP(s)) in the first argument in args and creates Resource object that can be used for\n// further transformations.\n//\n// A second argument may be provided with an option map.\n//\n// Note: This method does not return any error as a second return value,\n// for any error situations the error can be checked in .Err.\nfunc (ns *Namespace) GetRemote(args ...any) (resource.Resource, error) {\n\tget := func(args ...any) (resource.Resource, error) {\n\t\tif len(args) < 1 || len(args) > 2 {\n\t\t\treturn nil, errors.New(\"must provide an URL and optionally an options map\")\n\t\t}\n\n\t\turlstr, err := cast.ToStringE(args[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar options map[string]any\n\n\t\tif len(args) > 1 {\n\t\t\toptions, err = hmaps.ToStringMapE(args[1])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\treturn ns.createClient.FromRemote(urlstr, options)\n\t}","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/resources/resources.go#L98-L134","documentation":"Thrown by resources.GetRemote when the variadic args length is not 1 or 2. GetRemote expects exactly one URL string plus an optional options map. Zero args or more than two args triggers this.","triggerScenarios":"Calling {{ resources.GetRemote }} with no URL, or passing three or more arguments. Also when the URL argument is omitted because a variable was unset and not piped.","commonSituations":"Forgetting to pass the URL; passing extra positional arguments beyond the options map; piping nil into the call.","solutions":["Pass exactly one URL and an optional options map: {{ resources.GetRemote $url }} or {{ resources.GetRemote $url $opts }}.","Ensure the URL variable is set before calling.","Remove any extra arguments beyond the options map."],"exampleFix":"// before\n{{ resources.GetRemote }}\n// after\n{{ resources.GetRemote $url (dict \"method\" \"get\") }}","handlingStrategy":"validation","validationCode":"{{ with $url }}{{ resources.GetRemote . }}{{ end }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a URL string as the first argument.","Pass at most one optional options map as the second.","Guard nil URLs with {{ with }}."],"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"}