[hugo] "Unknown Format" Error Given when Attempting to Deploy to Production

Greetings!

My site name is photos-dalinwilliams, the site URL is photos.dalinwilliams.com, and the site id is a1509213-ebd5-48a0-bec8-d467d5c31f39.

I am have been using LMS to store photos which are used by my static site. However, when attempting to add new photos this morning, I have been encountering the following error when pushing to Netlify:

10:48:45 AM: hugo v0.99.1-d524067382e60ce2a2248c3133a1b3af206b6ef1+extended linux/amd64 BuildDate=2022-05-18T11:18:14Z VendorInfo=gohugoio
10:48:46 AM: ERROR 2022/06/16 17:48:46 render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:48:32": execute of template failed: template: _default/list.html:48:32: executing "main" at <$image.Resize>: error calling Resize: image "/opt/build/repo/assets/thumbnails/landscapes-nature_west-cost-roadtrip.jpg": resize thumbnails/landscapes-nature_west-cost-roadtrip.jpg: image: unknown format
10:48:46 AM: ERROR 2022/06/16 17:48:46 render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:247:31": execute of template failed: template: _default/list.html:247:31: executing "main" at <$elem_val.Resize>: error calling Resize: image "/opt/build/repo/assets/abstract/20210521120123_trip-to-venice-beach__1140.jpg": resize : image: unknown format
10:48:46 AM: ERROR 2022/06/16 17:48:46 render of "home" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:48:32": execute of template failed: template: _default/list.html:48:32: executing "main" at <$image.Resize>: error calling Resize: image "/opt/build/repo/assets/thumbnails/people.jpg": resize thumbnails/people.jpg: image: unknown format
10:48:46 AM: ERROR 2022/06/16 17:48:46 render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:247:31": execute of template failed: template: _default/list.html:247:31: executing "main" at <$elem_val.Resize>: error calling Resize: image "/opt/build/repo/assets/impressionistic-journalistic/20220519175437_edc-2022__4572.jpg": resize : image: unknown format
10:48:46 AM: Error: Error building site: failed to render pages: render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:48:32": execute of template failed: template: _default/list.html:48:32: executing "main" at <$image.Resize>: error calling Resize: image "/opt/build/repo/assets/thumbnails/impressionistic-journalistic_codex-umbra.jpg": resize thumbnails/impressionistic-journalistic_codex-umbra.jpg: image: unknown format

The same error is encountered after retrying the build after disabling/clearing the build cache.

I did have a network failure when uploading assets to the website, so I wonder if this could have introduced a few “bad files” into LMS - though I would be surprised if this is the point of failure.

I am stuck - why am I encountering this error? I can build the site locally after cloning into a new directory, so I am at a loss as to how I should proceed.

Full Build Log (build link):

11:00:21 AM: Build ready to start
11:01:32 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
11:01:32 AM: build-image tag: v4.8.0
11:01:32 AM: buildbot version: 785511f5c344fb31afdecdfe3e45beb4c5bb14ae
11:01:32 AM: Fetching cached dependencies
11:01:32 AM: Failed to fetch cache, continuing with build
11:01:32 AM: Starting to prepare the repo for build
11:01:32 AM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
11:01:32 AM: No cached dependencies found. Cloning fresh repo
11:01:32 AM: git clone https://github.com/dalinwilliams-com/photos.dalinwilliams.com-
11:01:58 AM: Preparing Git Reference refs/heads/main
11:01:59 AM: Parsing package.json dependencies
11:02:00 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI
11:02:00 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npm run deploy' versus 'hugo' in the Netlify UI
11:02:01 AM: Starting build script
11:02:01 AM: Installing dependencies
11:02:01 AM: Python version set to 2.7
11:02:01 AM: Downloading and installing node v16.15.1...
11:02:01 AM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz...
11:02:02 AM: Computing checksum with sha256sum
11:02:02 AM: Checksums matched!
11:02:05 AM: Now using node v16.15.1 (npm v8.11.0)
11:02:05 AM: Started restoring cached build plugins
11:02:05 AM: Finished restoring cached build plugins
11:02:05 AM: Attempting ruby version 2.7.2, read from environment
11:02:06 AM: Using ruby version 2.7.2
11:02:06 AM: Using PHP version 8.0
11:02:07 AM: No npm workspaces detected
11:02:07 AM: Started restoring cached node modules
11:02:07 AM: Finished restoring cached node modules
11:02:07 AM: Installing NPM modules using NPM version 8.11.0
11:02:08 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
11:02:08 AM: npm WARN config location in the cache, and they are managed by
11:02:08 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
11:02:08 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
11:02:08 AM: npm WARN config location in the cache, and they are managed by
11:02:08 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
11:02:28 AM: npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
11:02:28 AM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
11:02:28 AM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
11:02:29 AM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
11:02:29 AM: npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
11:02:30 AM: npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
11:02:30 AM: npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
11:02:31 AM: npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
11:02:32 AM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
11:02:32 AM: npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
11:02:33 AM: npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
11:02:33 AM: npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
11:02:34 AM: npm WARN deprecated svgo@0.7.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
11:02:36 AM: added 746 packages, and audited 747 packages in 28s
11:02:36 AM: 21 packages are looking for funding
11:02:36 AM:   run `npm fund` for details
11:02:36 AM: 49 vulnerabilities (38 moderate, 11 high)
11:02:36 AM: To address issues that do not require attention, run:
11:02:36 AM:   npm audit fix
11:02:36 AM: To address all issues possible (including breaking changes), run:
11:02:36 AM:   npm audit fix --force
11:02:36 AM: Some issues need review, and may require choosing
11:02:36 AM: a different dependency.
11:02:36 AM: Run `npm audit` for details.
11:02:36 AM: NPM modules installed
11:02:36 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
11:02:36 AM: npm WARN config location in the cache, and they are managed by
11:02:36 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
11:02:36 AM: Installing Hugo 0.99.1
11:02:37 AM: hugo v0.99.1-d524067382e60ce2a2248c3133a1b3af206b6ef1+extended linux/amd64 BuildDate=2022-05-18T11:18:14Z VendorInfo=gohugoio
11:02:37 AM: Started restoring cached go cache
11:02:37 AM: Finished restoring cached go cache
11:02:37 AM: go version go1.16.5 linux/amd64
11:02:37 AM: go version go1.16.5 linux/amd64
11:02:37 AM: Installing missing commands
11:02:37 AM: Verify run directory
11:02:39 AM: ​
11:02:39 AM: ────────────────────────────────────────────────────────────────
11:02:39 AM:   Netlify Build                                                 
11:02:39 AM: ────────────────────────────────────────────────────────────────
11:02:39 AM: ​
11:02:39 AM: ❯ Version
11:02:39 AM:   @netlify/build 27.1.5
11:02:39 AM: ​
11:02:39 AM: ❯ Flags
11:02:39 AM:   baseRelDir: true
11:02:39 AM:   buildId: 62ab6fb4596825107a67f7a0
11:02:39 AM:   deployId: 62ab6fb4596825107a67f7a2
11:02:39 AM: ​
11:02:39 AM: ❯ Current directory
11:02:39 AM:   /opt/build/repo
11:02:39 AM: ​
11:02:39 AM: ❯ Config file
11:02:39 AM:   /opt/build/repo/netlify.toml
11:02:39 AM: ​
11:02:39 AM: ❯ Context
11:02:39 AM:   production
11:02:40 AM: ​
11:02:40 AM: ❯ Installing plugins
11:02:40 AM:    - netlify-plugin-submit-sitemap@0.3.0
11:02:40 AM:    - netlify-plugin-hugo-cache-resources@0.2.1
11:02:41 AM: ​
11:02:41 AM: ❯ Loading plugins
11:02:41 AM:    - netlify-plugin-submit-sitemap@0.3.0 from netlify.toml
11:02:41 AM:    - netlify-plugin-hugo-cache-resources@0.2.1 from netlify.toml
11:02:43 AM: ​
11:02:43 AM: ────────────────────────────────────────────────────────────────
11:02:43 AM:   1. netlify-plugin-hugo-cache-resources (onPreBuild event)     
11:02:43 AM: ────────────────────────────────────────────────────────────────
11:02:43 AM: ​
11:02:43 AM: Checking if resources exist at "resources"
11:02:43 AM: No cache found for resources folder
11:02:43 AM: ​
11:02:43 AM: (netlify-plugin-hugo-cache-resources onPreBuild completed in 9ms)
11:02:43 AM: ​
11:02:43 AM: ────────────────────────────────────────────────────────────────
11:02:43 AM:   2. build.command from netlify.toml                            
11:02:43 AM: ────────────────────────────────────────────────────────────────
11:02:43 AM: ​
11:02:43 AM: $ npm run deploy
11:02:43 AM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
11:02:43 AM: npm WARN config location in the cache, and they are managed by
11:02:43 AM: npm WARN config     [`cacache`](http://npm.im/cacache).
11:02:43 AM: > hugo-comments@1.0.0 deploy
11:02:43 AM: > gulp build && hugo --minify --environment production
11:02:45 AM: [18:02:45] Using gulpfile /opt/build/repo/gulpfile.js
11:02:45 AM: [18:02:45] Starting 'build'...
11:02:45 AM: [18:02:45] Starting 'procss'...
11:02:50 AM: [18:02:50] Finished 'procss' after 4.86 s
11:02:50 AM: [18:02:50] Starting 'get-comments'...
11:02:50 AM: Submissions found
11:02:50 AM: Comments data saved.
11:02:50 AM: [18:02:50] Finished 'get-comments' after 84 ms
11:02:50 AM: [18:02:50] Finished 'build' after 4.95 s
11:02:52 AM: hugo: downloading modules …
11:02:56 AM: hugo: collected modules in 6528 ms
11:02:56 AM: Start building sites …
11:02:56 AM: hugo v0.99.1-d524067382e60ce2a2248c3133a1b3af206b6ef1+extended linux/amd64 BuildDate=2022-05-18T11:18:14Z VendorInfo=gohugoio
11:02:57 AM: ERROR 2022/06/16 18:02:57 render of "home" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:48:32": execute of template failed: template: _default/list.html:48:32: executing "main" at <$image.Resize>: error calling Resize: image "/opt/build/repo/assets/thumbnails/people.jpg": resize thumbnails/people.jpg: image: unknown format
11:02:57 AM: ERROR 2022/06/16 18:02:57 render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:48:32": execute of template failed: template: _default/list.html:48:32: executing "main" at <$image.Resize>: error calling Resize: image "/opt/build/repo/assets/thumbnails/impressionistic-journalistic_codex-umbra.jpg": resize thumbnails/impressionistic-journalistic_codex-umbra.jpg: image: unknown format
11:02:57 AM: ERROR 2022/06/16 18:02:57 render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:247:31": execute of template failed: template: _default/list.html:247:31: executing "main" at <$elem_val.Resize>: error calling Resize: image "/opt/build/repo/assets/impressionistic-journalistic/20211120104722_smith-rock-2021__4627.jpg": resize : image: unknown format
11:02:57 AM: ERROR 2022/06/16 18:02:57 render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:48:32": execute of template failed: template: _default/list.html:48:32: executing "main" at <$image.Resize>: error calling Resize: image "/opt/build/repo/assets/thumbnails/people_parijat-protim-bezbaruah.jpg": resize thumbnails/people_parijat-protim-bezbaruah.jpg: image: unknown format
11:02:57 AM: Error: Error building site: failed to render pages: render of "section" failed: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/dalinwilliams-com/autophugo@v0.0.0-20220611183551-cfc65eb541dc/layouts/_default/list.html:247:31": execute of template failed: template: _default/list.html:247:31: executing "main" at <$elem_val.Resize>: error calling Resize: image "/opt/build/repo/assets/impressionistic-journalistic/20220604212745_trinity---quoth-the-raver__5197.jpg": resize : image: unknown format
11:02:57 AM: Total in 6766 ms
11:02:57 AM: ​
11:02:57 AM: ────────────────────────────────────────────────────────────────
11:02:57 AM:   "build.command" failed                                        
11:02:57 AM: ────────────────────────────────────────────────────────────────
11:02:57 AM: ​
11:02:57 AM:   Error message
11:02:57 AM:   Command failed with exit code 255: npm run deploy (https://ntl.fyi/exit-code-255)
11:02:57 AM: ​
11:02:57 AM:   Error location
11:02:57 AM:   In build.command from netlify.toml:
11:02:57 AM:   npm run deploy
11:02:57 AM: ​
11:02:57 AM:   Resolved config
11:02:57 AM:   build:
11:02:57 AM:     base: /opt/build/repo
11:02:57 AM:     command: npm run deploy
11:02:57 AM:     commandOrigin: config
11:02:57 AM:     environment:
11:02:57 AM:       - API_AUTH
11:02:57 AM:       - COMMENT_FORM_ID
11:02:57 AM:       - NETLIFY_LFS_ORIGIN_URL
11:02:57 AM:       - ONEGRAPH_AUTHLIFY_TOKEN
11:02:57 AM:       - HUGO_VERSION
11:02:57 AM:       - HUGO_ENV
11:02:57 AM:       - HUGO_ENABLEGITINFO
11:02:57 AM:       - command
11:02:57 AM:     publish: /opt/build/repo/public
11:02:57 AM:     publishOrigin: config
11:02:57 AM:   plugins:
11:02:57 AM:     - inputs: {}
11:02:57 AM:       origin: config
11:02:57 AM:       package: netlify-plugin-submit-sitemap
11:02:57 AM:     - inputs:
11:02:57 AM:         debug: false
11:02:57 AM:       origin: config
11:02:57 AM:       package: netlify-plugin-hugo-cache-resources
11:02:57 AM: Caching artifacts
11:02:57 AM: Started saving node modules
11:02:57 AM: Finished saving node modules
11:02:57 AM: Started saving build plugins
11:02:57 AM: Finished saving build plugins
11:02:57 AM: Started saving pip cache
11:02:57 AM: Finished saving pip cache
11:02:57 AM: Started saving emacs cask dependencies
11:02:57 AM: Finished saving emacs cask dependencies
11:02:57 AM: Started saving maven dependencies
11:02:57 AM: Finished saving maven dependencies
11:02:57 AM: Started saving boot dependencies
11:02:57 AM: Finished saving boot dependencies
11:02:57 AM: Started saving rust rustup cache
11:02:57 AM: Finished saving rust rustup cache
11:02:57 AM: Started saving go dependencies
11:02:57 AM: Finished saving go dependencies
11:02:59 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:02:59 AM: Creating deploy upload records
11:02:59 AM: Failing build: Failed to build site
11:02:59 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
11:02:59 AM: Finished processing build request in 1m27.685496726s

As an additional note - I can run git lfs ls-files and see that these files are present:

xxx@xxx photos-dalinwilliams-com % git lfs ls-files | ag assets/thumbnails/landscapes-nature_west-cost-roadtrip.jpg
5b9d60aa88 * assets/thumbnails/landscapes-nature_west-cost-roadtrip.jpg

However, if I check in my Netlify Large Media console, the files are missing:

.

I have successfully ran git lfs push --all origin:

xxx@xxx photos-dalinwilliams-com % git lfs push --all origin

Uploading LFS objects: 100% (3077/3077), 1.3 GB | 0 B/s, done.    

So I am unsure why I these photos are not being uploaded succesfully…

I have gone ahead and removed LFS from my project entirely. I will recreate and see if that solves the issue.

I would really appreciate any insight as to what caused this error!

hey there @funkeyfreak , glad you have a workaround. The person on the team who knows most about LFS is out for the weekend, but i’ll make sure he sees this and can hopefully weigh in once he’s back.

Hey @funkeyfreak,

I’m not the person Perry mentioned above, but to answer your question, Netlify Large Media cannot be used for build-time transformations, thus the error.

I just want to +1 what @hrishikesh said. If you use Large Media (not if you use Git LFS in general, but Large Media in specific), then the files themselves no longer exist in the build image. This means that you cannot do build time image transformations of the images.

With Large Media, only on-demand transforms are possible at request time. There is more documentation about this here:

So, if you use the Git LFS service of your Git host (GitHub in this case) then the images can be transformed during the build but not a request time. If you use Large Media, then the images can be transformed at request time but not during this build.

We did already remove the Large Media instance from this site once. If you want to remove it again to resolve this, please let us know.