I am using GitHub action to build a site with goHUGO, after updating HUGO to a newer version I get different errors my GitHub action as well during building off line in my laptop:
Github
Run hugo --gc --minify --baseURL "http://zxx/"
Start building sites …
hugo v0.143.1-0270364a347b2ece97e0321782b21904db515ecc+extended linux/amd64 BuildDate=2025-02-04T08:57:38Z VendorInfo=gohugoio
ERROR render of "/home/runner/work/.github.io//content/projects/_index.html" failed: "/home/runner/work//github/layouts/projects/list.en.html:25:34": execute of template failed: template: projects/list.en.html:25:34: executing "main" at <$image.Fill>: error calling Fill: fill /projects/x1/featurex.jpg: image: unknown format
Total in 604 ms
Error: error building site: render: failed to render pages: render of "/" failed: "/home/runner/work/igithub.io/layouts/index.en.html:130:26": execute of template failed: template: index.en.html:130:26: executing "main" at <$image.Fill>: error calling Fill: fill /projects/x1/featurex.jpg: image: unknown format
Error: Process completed with exit code 1.
in my laptop
Watching for config changes in /Users/x.github.io/config.toml
Start building sites …
hugo v0.143.1+extended+withdeploy darwin/arm64 BuildDate=2025-02-04T08:57:38Z VendorInfo=brew
Built in 887 ms
Error: error building site: render: failed to render pages: render of "/Users/x/Projects/x/content/projects/_index.html" failed: "/Users/x/Projects/x/layouts/projects/list.en.html:25:34": execute of template failed: template: projects/list.en.html:25:34: executing "main" at <$filled.Convert>: can't evaluate field Convert in type images.ImageResource
The code
<div class="bg-light py-5">
<div class="container">
<div class="row mb-lg-5 justify-content-center">
{{ range first 9 (where .Site.RegularPages.ByWeight "Type" "projects") }}
{{/* Retrieve the project’s feature image */}}
{{ $original := .Resources.GetMatch "feature.jpg" }}
{{ if not $original }}
{{/* Fallback to a global default image if not found */}}
{{ $original = resources.Get "images/default-feature.jpg" }}
{{ end }}
{{/* First, resize the image – note we don’t include the format here */}}
{{ $filled := $original.Fill "688x460 center" }}
{{/* Then convert the filled image to WebP */}}
{{ $processed := $filled.Convert "webp" }}
<div class="col-lg-3 col-md-6 mb-4">
<a href="{{ .RelPermalink }}" class="card-link">
<div class="card shadow-sm border-0 h-100" data-aos="fade-up" data-aos-duration="1000">
<img class="card-img-top" src="{{ $processed.RelPermalink }}" alt="{{ .Title }}">
<div class="card-body d-flex flex-column">
<p class="card-text flex-grow-1 mb-5">{{ .Params.description }}</p>
<a href="{{ .RelPermalink }}" class="btn btn-sm btn-primary mt-auto stretched-link">Learn More</a>
</div>
</div>
</a>
</div>
{{ end }}
</div>
</div>
</div>
without access to your project sources just an educated guess:
First: If you get different errors locally and on GitHub, looks like you work on different commits, branches … I would recommend to check if both are in sync
GitHub
error calling Fill: fill /projects/x1/featurex.jpg: image: unknown format
There’s something found, but the format is unknown, maybe it’s a webp image but the name is jpg, …maybe related to First from above:
check the media type using:
{{ with resources.Get "images/a.jpg" }}
{{ .MediaType.Type }} → image/jpeg
{{ end }}
Locally
executing "main" at <$filled.Convert>: can't evaluate field Convert in type images.ImageResource
If it’s the same code, the image loaded is a jpg and the Fill worked. (seems First is true)
I cannot find any resource or image method called Convert in the current docs. Where did you get that from, which old hugo version worked?
The error message on GitHub tell it is not or at least hugo does not get it, that it is one
The problem locally seems to be calling a non existent Convert method
unless you need more performance (tons of images to convert) you will be fine with hugos image pipeline. The manual page linked above has an example how to convert a jpg to webp format.
This is strange. I changed the picture and put another. I even changed the approach to resized using the link you mentioned. but still the error points to this line
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.