Unable to deploy Hugo Academic Website via Git

Hi all, newbie user here. So, after building my website using Hugo Academic and adding all to my public GitHub repository, I then tried to deploy my website on Netlify, however it does not work as I get an error, which I am not able to really make sense of. Any suggestions on what I can do to fix this? Deployment using Hugo should be really use but not in my case for some reason… Full log below:

8:49:00 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)
8:49:00 PM: build-image tag: v4.16.1
8:49:00 PM: buildbot version: 33f88475bcf3426608b49b7681d295235efb41f1
8:49:00 PM: Fetching cached dependencies
8:49:00 PM: Failed to fetch cache, continuing with build
8:49:00 PM: Starting to prepare the repo for build
8:49:00 PM: No cached dependencies found. Cloning fresh repo
8:49:00 PM: git clone https://github.com/xxx/website
8:49:01 PM: Preparing Git Reference refs/heads/main
8:49:01 PM: Parsing package.json dependencies
8:49:02 PM: Starting build script
8:49:02 PM: Installing dependencies
8:49:02 PM: Python version set to 2.7
8:49:02 PM: v16.19.0 is already installed.
8:49:03 PM: Now using node v16.19.0 (npm v8.19.3)
8:49:03 PM: Enabling node corepack
8:49:03 PM: Started restoring cached build plugins
8:49:03 PM: Finished restoring cached build plugins
8:49:03 PM: Attempting ruby version 2.7.2, read from environment
8:49:03 PM: Using ruby version 2.7.2
8:49:03 PM: Using PHP version 8.0
8:49:03 PM: Installing Hugo 0.108.0
8:49:04 PM: hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended linux/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio
8:49:04 PM: Started restoring cached go cache
8:49:04 PM: Finished restoring cached go cache
8:49:05 PM: go version go1.19.4 linux/amd64
8:49:06 PM: Detected 0 framework(s)
8:49:06 PM: Installing missing commands
8:49:06 PM: Verify run directory
8:49:06 PM: Section completed: initializing
8:49:07 PM: ​
8:49:07 PM: Netlify Build
8:49:07 PM: ────────────────────────────────────────────────────────────────
8:49:07 PM: ​
8:49:07 PM: ❯ Version
8:49:07 PM: @netlify/build 29.2.1
8:49:07 PM: ​
8:49:07 PM: ❯ Flags
8:49:07 PM: baseRelDir: true
8:49:07 PM: buildId: 63aa08ba441cc565e20cbf94
8:49:07 PM: deployId: 63aa08ba441cc565e20cbf96
8:49:07 PM: ​
8:49:07 PM: ❯ Current directory
8:49:07 PM: /opt/build/repo
8:49:07 PM: ​
8:49:07 PM: ❯ Config file
8:49:07 PM: /opt/build/repo/netlify.toml
8:49:07 PM: ​
8:49:07 PM: ❯ Context
8:49:07 PM: production
8:49:07 PM: ​
8:49:07 PM: 1. build.command from netlify.toml
8:49:07 PM: ────────────────────────────────────────────────────────────────
8:49:07 PM: ​
8:49:07 PM: $ hugo
8:49:07 PM: Start building sites …
8:49:07 PM: hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended linux/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio
8:49:07 PM: Error: Error building site: render of “404” failed: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5/layouts/_default/baseof.html:7:3”: execute of template failed: template: 404.html:7:3: executing “404.html” at <partial “site_head” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5/layouts/partials/site_head.html:191:5”: execute of template failed: template: partials/site_head.html:191:5: executing “partials/site_head.html” at <partial “wowchemy_seo” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-seo/layouts/partials/wowchemy_seo.html:6:3”: execute of template failed: template: partials/wowchemy_seo.html:6:3: executing “partials/wowchemy_seo.html” at <partial “seo_tags” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-seo/layouts/partials/seo_tags.html:48:12”: execute of template failed: template: partials/seo_tags.html:48:12: executing “partials/seo_tags.html” at <site.Home.OutputFormats.Get>: error calling OutputFormats: runtime error: invalid memory address or nil pointer dereference
8:49:07 PM: Total in 227 ms
8:49:07 PM: ​
8:49:07 PM: “build.command” failed
8:49:07 PM: ────────────────────────────────────────────────────────────────
8:49:07 PM: ​
8:49:07 PM: Error message
8:49:08 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:49:07 PM: Command failed with exit code 255: hugo (Search results for '"non-zero exit code: 255"' - Netlify Support Forums)
8:49:07 PM: ​
8:49:07 PM: Error location
8:49:07 PM: In build.command from netlify.toml:
8:49:07 PM: hugo
8:49:07 PM: ​
8:49:07 PM: Resolved config
8:49:07 PM: build:
8:49:07 PM: command: hugo
8:49:07 PM: commandOrigin: config
8:49:07 PM: environment:
8:49:07 PM: - HUGO_VERSION
8:49:07 PM: - HUGO_ENV
8:49:07 PM: publish: /opt/build/repo/public
8:49:07 PM: publishOrigin: config
8:49:08 PM: Caching artifacts
8:49:08 PM: Started saving build plugins
8:49:08 PM: Finished saving build plugins
8:49:08 PM: Started saving pip cache
8:49:08 PM: Finished saving pip cache
8:49:08 PM: Started saving emacs cask dependencies
8:49:08 PM: Finished saving emacs cask dependencies
8:49:08 PM: Started saving maven dependencies
8:49:08 PM: Finished saving maven dependencies
8:49:08 PM: Started saving boot dependencies
8:49:08 PM: Finished saving boot dependencies
8:49:08 PM: Started saving rust rustup cache
8:49:08 PM: Finished saving rust rustup cache
8:49:08 PM: Started saving go dependencies
8:49:08 PM: Finished saving go dependencies
8:49:08 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:49:08 PM: Failing build: Failed to build site
8:49:08 PM: Finished processing build request in 8.348396605s

Looks like something is wrong in your config, or you are using some features not in the version of hugo we ran for you:

8:49:03 PM: Installing Hugo 0.108.0
8:49:04 PM: hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended linux/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio

I suppose that when you run locally, this doesn’t occur? Have you set an explicit HUGO_VERSION environment variable to ensure we run the same version as you, as described here? Build environment variables | Netlify Docs

I can’t find any site by the name you mention, so I couldn’t look directly at your config, but if the above doesn’t help, please review this guide for debugging builds on Netlify and then answer the 3 questions at bottom (here in this thread is fine!) in case you didn’t solve things:

Thank you so much for your reply. I re-deployed and the website got another link, this one: https://deluxe-paletas-2de5bb.netlify.app/

You’re right. When I serve my website locally it works fine. However, after trying to re-deploy again, I am still getting an error though. I did specify the HUGO_VERSION, but nothing changed. Also, the HUGO_VERSION parameter is specified in the netlify.toml file.

I wonder if the error log indicates I need to do something in relation to my website’s SEO?

10:50:07 PM: Error: Error building site: render of “404” failed: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5/layouts/_default/baseof.html:7:3”: execute of template failed: template: 404.html:7:3: executing “404.html” at <partial “site_head” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5/layouts/partials/site_head.html:191:5”: execute of template failed: template: partials/site_head.html:191:5: executing “partials/site_head.html” at <partial “wowchemy_seo” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-seo/layouts/partials/wowchemy_seo.html:6:3”: execute of template failed: template: partials/wowchemy_seo.html:6:3: executing “partials/wowchemy_seo.html” at <partial “seo_tags” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-seo/layouts/partials/seo_tags.html:48:12”: execute of template failed: template: partials/seo_tags.html:48:12: executing “partials/seo_tags.html” at <site.Home.OutputFormats.Get>: error calling OutputFormats: runtime error: invalid memory address or nil pointer dereference

Full error log:

11:36:03 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)
11:36:03 PM: build-image tag: v4.16.1
11:36:03 PM: buildbot version: 33f88475bcf3426608b49b7681d295235efb41f1
11:36:04 PM: Building without cache
11:36:04 PM: Starting to prepare the repo for build
11:36:04 PM: No cached dependencies found. Cloning fresh repo
11:36:04 PM: git clone https://github.com/halleypontes/website
11:36:04 PM: Preparing Git Reference refs/heads/main
11:36:05 PM: Parsing package.json dependencies
11:36:06 PM: Starting build script
11:36:06 PM: Installing dependencies
11:36:06 PM: Python version set to 2.7
11:36:06 PM: v16.19.0 is already installed.
11:36:06 PM: Now using node v16.19.0 (npm v8.19.3)
11:36:06 PM: Enabling node corepack
11:36:06 PM: Started restoring cached build plugins
11:36:06 PM: Finished restoring cached build plugins
11:36:06 PM: Attempting ruby version 2.7.2, read from environment
11:36:07 PM: Using ruby version 2.7.2
11:36:07 PM: Using PHP version 8.0
11:36:07 PM: Installing Hugo 0.108.0
11:36:08 PM: hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended linux/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio
11:36:08 PM: Started restoring cached go cache
11:36:08 PM: Finished restoring cached go cache
11:36:09 PM: go version go1.19.4 linux/amd64
11:36:09 PM: Detected 0 framework(s)
11:36:09 PM: Installing missing commands
11:36:09 PM: Verify run directory
11:36:09 PM: Section completed: initializing
11:36:11 PM: ​
11:36:11 PM: Netlify Build
11:36:11 PM: ────────────────────────────────────────────────────────────────
11:36:11 PM: ​
11:36:11 PM: ❯ Version
11:36:11 PM: @netlify/build 29.2.1
11:36:11 PM: ​
11:36:11 PM: ❯ Flags
11:36:11 PM: baseRelDir: true
11:36:11 PM: buildId: 63aa2fe24f8b8b0b9a9e055e
11:36:11 PM: deployId: 63aa2fe24f8b8b0b9a9e0560
11:36:11 PM: ​
11:36:11 PM: ❯ Current directory
11:36:11 PM: /opt/build/repo
11:36:11 PM: ​
11:36:11 PM: ❯ Config file
11:36:11 PM: /opt/build/repo/netlify.toml
11:36:11 PM: ​
11:36:11 PM: ❯ Context
11:36:11 PM: production
11:36:11 PM: ​
11:36:11 PM: 1. build.command from netlify.toml
11:36:11 PM: ────────────────────────────────────────────────────────────────
11:36:11 PM: ​
11:36:11 PM: $ hugo
11:36:11 PM: Start building sites …
11:36:11 PM: hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended linux/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio
11:36:11 PM: Error: Error building site: render of “404” failed: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5/layouts/_default/baseof.html:7:3”: execute of template failed: template: 404.html:7:3: executing “404.html” at <partial “site_head” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5/layouts/partials/site_head.html:191:5”: execute of template failed: template: partials/site_head.html:191:5: executing “partials/site_head.html” at <partial “wowchemy_seo” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-seo/layouts/partials/wowchemy_seo.html:6:3”: execute of template failed: template: partials/wowchemy_seo.html:6:3: executing “partials/wowchemy_seo.html” at <partial “seo_tags” .>: error calling partial: “/opt/build/repo/themes/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-seo/layouts/partials/seo_tags.html:48:12”: execute of template failed: template: partials/seo_tags.html:48:12: executing “partials/seo_tags.html” at <site.Home.OutputFormats.Get>: error calling OutputFormats: runtime error: invalid memory address or nil pointer dereference
11:36:11 PM: Total in 225 ms
11:36:11 PM: ​
11:36:11 PM: “build.command” failed
11:36:11 PM: ────────────────────────────────────────────────────────────────
11:36:11 PM: ​
11:36:11 PM: Error message
11:36:11 PM: Command failed with exit code 255: hugo (Search results for '"non-zero exit code: 255"' - Netlify Support Forums)
11:36:11 PM: ​
11:36:11 PM: Error location
11:36:11 PM: In build.command from netlify.toml:
11:36:12 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
11:36:11 PM: hugo
11:36:11 PM: ​
11:36:11 PM: Resolved config
11:36:11 PM: build:
11:36:11 PM: command: hugo
11:36:11 PM: commandOrigin: config
11:36:11 PM: environment:
11:36:11 PM: - HUGO_VERSION
11:36:11 PM: - HUGO_ENV
11:36:11 PM: publish: /opt/build/repo/public
11:36:11 PM: publishOrigin: config
11:36:11 PM: Caching artifacts
11:36:11 PM: Started saving build plugins
11:36:11 PM: Finished saving build plugins
11:36:11 PM: Started saving pip cache
11:36:11 PM: Finished saving pip cache
11:36:11 PM: Started saving emacs cask dependencies
11:36:11 PM: Finished saving emacs cask dependencies
11:36:11 PM: Started saving maven dependencies
11:36:11 PM: Finished saving maven dependencies
11:36:11 PM: Started saving boot dependencies
11:36:11 PM: Finished saving boot dependencies
11:36:11 PM: Started saving rust rustup cache
11:36:11 PM: Finished saving rust rustup cache
11:36:11 PM: Started saving go dependencies
11:36:11 PM: Finished saving go dependencies
11:36:12 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:36:12 PM: Failing build: Failed to build site
11:36:12 PM: Finished processing build request in 8.947389472s

Hey @netlifier8 , I’ve taken a look at your new site and, based on the error in the build logs, it looks like Hugo is not able to find the template in the directory specified. We’ve seen this on Netlify in the past, but those were mostly due to an outdated/old Hugo version (not the one you are using for this site.

That said, I did some searching online and I wonder if any of the recommendations in this article might help you debug further:

https://kodify.net/hugo/errors/partial-not-found/

Let us know if that helps!

Thank you Amelia, I haven’t changed or fiddled with any of the partials, why do I need to edit these now? I basically built up my website on top of the original template. I am still not sure about what’s the actual problem :frowning:

Hiya @netlifier8 :wave:t6: , this has been escalated to our support engineers please stay tuned to your email.