Hugo v0.143.1 Can't evaluate field Convert in type images.ImageResource + <$image.Fill>: error calling Fil

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?

according to Image Processing - Target Format you will have to call a Filter to change the format.

It’s a jpg image and am trying to transform it using web and make the site light. is there any other way?

The error message on GitHub tell it is not :wink: 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

        {{ $resized := .Resize (printf "%dx%d webp" 688 460) }}

Does this looks like a good Hugo.yml file?


name: Deploy Hugo site to Pages

on:
  push:
    branches: [ "main" ]
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source
        uses: actions/checkout@v3

      - name: Cache dependencies
        uses: actions/cache@v4
        with:
          path: |
            **/node_modules
          key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-npm-cache-

      - name: Setup GitHub Pages
        id: pages
        uses: actions/configure-pages@v5

      - name: Install Node.js dependencies
        run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
      - name: List files in public folder after
        run: rm -rf public resources

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: '0.140.1'
          extended: true

      - name: Build with Hugo
        env:
          HUGO_ENVIRONMENT: production
          HUGO_ENV: production
        run: >
          Hugo
          --gc
          --minify
          --baseURL "${{ steps.pages.outputs.base_url }}/"
      - name: List files in public folder after
        run: find public -type f

      - name: Upload Pages artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./public



  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build

    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

You are more likely to receive a prompt and accurate response if you post a link to your project’s Git repository.

See Requesting Help.

Let us see your code

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.

that does not match your error report which says 143…

compare yours with the one from the hugo docs. look in the forum gheres a recen post about the action versiond deprecated by github

and ofc @jmooring is right.

it does not make sense to cherry-pick one info fter another…

Here is the culprit. I have LFS enabled in my repo and didn’t add it to Hugo action file.

steps:
  - name: Checkout source
    uses: actions/checkout@v3
    with:
        lfs: true // this