Build problems: Failed to read Git log - exit code 255

I can’t build my site through Netlify, something stopped working. I have another website and it is building ok, I’m not sure what is the issue with mine. Please, can you help me with this issue?

My project repo is: GitHub - bienflorencia/personal-site: Personal website

Many thanks!
Flo

1 Like
  1. Ensure your Hugo versions are the same, both locally and on Netlify.
  2. The baseURL should be set to the URL of your site, not /.

Hi @steppa, thanks for your reply.
My site has been live for ages now, this is the first time I encountered this issue.

They are both the same, I neve changed this.

The baseURL is the URL of my site. As I said, I didn’t change any of this.

Your netlify.toml file has HUGO_VERSION = "0.52". That is not the current Hugo version. Run the hugo version command on your local Hugo site and add that version to the netlify file.

Thanks for your help!
I don’t use hugo locally, but in any case, I changed the version both in my netlify.toml file and the Environment variables on the netlify site.

I now get the following error:

12:56:20 PM: build-image version: d55944c047ef0aee2ac01971edde72cb2a50acfe (focal)
12:56:20 PM: build-image tag: v4.16.1
12:56:20 PM: buildbot version: 172dfeb26b5928858f685fc5ef4400a815f3fd75
12:56:20 PM: Fetching cached dependencies
12:56:20 PM: Starting to download cache of 641.4MB
12:56:24 PM: Finished downloading cache in 3.834401459s
12:56:24 PM: Starting to extract cache
12:56:25 PM: Finished extracting cache in 994.374714ms
12:56:25 PM: Finished fetching cache in 4.906713833s
12:56:25 PM: Starting to prepare the repo for build
12:56:26 PM: Preparing Git Reference refs/heads/master
12:56:26 PM: git clone --filter=blob:none git@github.com:bienflorencia/personal-site
12:56:36 PM: Parsing package.json dependencies
12:56:37 PM: Starting build script
12:56:37 PM: Installing dependencies
12:56:37 PM: Python version set to 2.7
12:56:37 PM: Started restoring cached node version
12:56:37 PM: Finished restoring cached node version
12:56:38 PM: v8.17.0 is already installed.
12:56:38 PM: Now using node v8.17.0 (npm v6.13.4)
12:56:38 PM: Started restoring cached build plugins
12:56:38 PM: Finished restoring cached build plugins
12:56:38 PM: Attempting ruby version 2.7.2, read from environment
12:56:39 PM: Using ruby version 2.7.2
12:56:39 PM: Using PHP version 8.0
12:56:39 PM: Installing Hugo 0.109.0
12:56:40 PM: hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371+extended linux/amd64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio
12:56:40 PM: Started restoring cached go cache
12:56:40 PM: Finished restoring cached go cache
12:56:40 PM: Installing Go version 1.10 (requested 1.10)
12:56:44 PM: unset GOOS;
12:56:44 PM: unset GOARCH;
12:56:44 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
12:56:44 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
12:56:44 PM: go version >&2;
12:56:44 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.10.linux.amd64.env"
12:56:44 PM: go version go1.10 linux/amd64
12:56:44 PM: Detected 2 framework(s)
12:56:44 PM: "hugo" at version "unknown"
12:56:44 PM: "zola" at version "unknown"
12:56:44 PM: Installing missing commands
12:56:44 PM: Verify run directory
12:56:44 PM: Section completed: initializing
12:56:46 PM: ​
12:56:46 PM:   Netlify Build                                                 
12:56:46 PM: ────────────────────────────────────────────────────────────────
12:56:46 PM: ​
12:56:46 PM: ❯ Version
12:56:46 PM:   @netlify/build 29.4.0
12:56:46 PM: ​
12:56:46 PM: ❯ Flags
12:56:46 PM:   baseRelDir: false
12:56:46 PM:   buildId: 63bc00e3dc3f820207293c85
12:56:46 PM:   deployId: 63bc00e3dc3f820207293c87
12:56:46 PM: ​
12:56:46 PM: ❯ Current directory
12:56:46 PM:   /opt/build/repo
12:56:46 PM: ​
12:56:46 PM: ❯ Config file
12:56:46 PM:   /opt/build/repo/netlify.toml
12:56:46 PM: ​
12:56:46 PM: ❯ Context
12:56:46 PM:   production
12:56:46 PM: ​
12:56:46 PM:   1. build.command from netlify.toml                            
12:56:46 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:56:46 PM: ────────────────────────────────────────────────────────────────
12:56:46 PM: ​
12:56:46 PM: $ hugo
12:56:46 PM: Start building sites …
12:56:46 PM: hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371+extended linux/amd64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio
12:56:46 PM: ERROR 2023/01/09 11:56:46 render of "page" failed: "/opt/build/repo/themes/academic/layouts/_default/single.html:1:3": execute of template failed: template: _default/single.html:1:3: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/opt/build/repo/themes/academic/layouts/partials/header.html:9:10": execute of template failed: template: partials/header.html:9:10: executing "partials/header.html" at <.Hugo.Generator>: can't evaluate field Hugo in type *hugolib.pageState
ERROR 2023/01/09 11:56:46 render of "page" failed: "/opt/build/repo/themes/academic/layouts/_default/single.html:1:3": execute of template failed: template: _default/single.html:1:3: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/opt/build/repo/themes/academic/layouts/partials/header.html:9:10": execute of template failed: template: partials/header.html:9:10: executing "partials/header.html" at <.Hugo.Generator>: can't evaluate field Hugo in type *hugolib.pageState
ERROR 2023/01/09 11:56:46 render of "page" failed: "/opt/build/repo/themes/academic/layouts/project/single.html:1:3": execute of template failed: template: project/single.html:1:3: executing "project/single.html" at <partial "header.html" .>: error calling partial: "/opt/build/repo/themes/academic/layouts/partials/header.html:9:10": execute of template failed: template: partials/header.html:9:10: executing "partials/header.html" at <.Hugo.Generator>: can't evaluate field Hugo in type *hugolib.pageState
ERROR 2023/01/09 11:56:46 render of "page" failed: "/opt/build/repo/themes/academic/layouts/_default/single.html:1:3": execute of template failed: template: _default/single.html:1:3: executing "_default/single.html" at <partial "header.html" .>: error calling partial: "/opt/build/repo/themes/academic/layouts/partials/header.html:9:10": execute of template failed: template: partials/header.html:9:10: executing "partials/header.html" at <.Hugo.Generator>: can't evaluate field Hugo in type *hugolib.pageState
Error: Error building site: failed to render pages: render of "page" failed: "/opt/build/repo/themes/academic/layouts/project/single.html:1:3": execute of template failed: template: project/single.html:1:3: executing "project/single.html" at <partial "header.html" .>: error calling partial: "/opt/build/repo/themes/academic/layouts/partials/header.html:9:10": execute of template failed: template: partials/header.html:9:10: executing "partials/header.html" at <.Hugo.Generator>: can't evaluate field Hugo in type *hugolib.pageState
Total in 121 ms
12:56:46 PM: ​
12:56:46 PM:   "build.command" failed                                        
12:56:46 PM: ────────────────────────────────────────────────────────────────
12:56:46 PM: ​
12:56:46 PM:   Error message
12:56:46 PM:   Command failed with exit code 255: hugo (https://ntl.fyi/exit-code-255)
12:56:46 PM: ​
12:56:46 PM:   Error location
12:56:46 PM:   In build.command from netlify.toml:
12:56:46 PM:   hugo
12:56:46 PM: ​
12:56:46 PM:   Resolved config
12:56:46 PM:   build:
12:56:46 PM:     command: hugo
12:56:46 PM:     commandOrigin: config
12:56:46 PM:     environment:
12:56:46 PM:       - GIT_CONFIG_NOSYSTEM
12:56:46 PM:       - HUGO_VERSION
12:56:46 PM:       - HUGO_ENV
12:56:46 PM:       - HUGO_ENABLEGITINFO
12:56:46 PM:     publish: /opt/build/repo/public
12:56:46 PM:     publishOrigin: config
12:56:46 PM: Caching artifacts
12:56:46 PM: Started saving build plugins
12:56:46 PM: Finished saving build plugins
12:56:46 PM: Started saving pip cache
12:56:46 PM: Finished saving pip cache
12:56:46 PM: Started saving emacs cask dependencies
12:56:46 PM: Finished saving emacs cask dependencies
12:56:46 PM: Started saving maven dependencies
12:56:46 PM: Finished saving maven dependencies
12:56:46 PM: Started saving boot dependencies
12:56:46 PM: Finished saving boot dependencies
12:56:46 PM: Started saving rust rustup cache
12:56:46 PM: Finished saving rust rustup cache
12:56:46 PM: Started saving go dependencies
12:56:46 PM: Finished saving go dependencies
12:56:46 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:56:46 PM: Failing build: Failed to build site
12:56:47 PM: Finished processing build request in 26.447805767s

Then how do you generate your site? Because you NEED to have a local version of your site to run Hugo?

As for the error, open your partials/header.html file and change Hugo.Generator to hugo.Generator.

Did you ever get this resolved? I am experiencing this issue with a website I’ve had for a while as well… hugo versions match, baseURL is correct…

Unfortunately, I couldn’t fix it. I ended up updating my whole website to the most up-to-date version of the theme I was using (academic - wowchemy). Super annoying, but I was not being able to push any changes. Good luck!