"build.command" failed. Please I have been battling with this for long and I have explored all available means to me. SOS!

12:35:33 AM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
12:35:33 AM: build-image tag: v4.15.0
12:35:33 AM: buildbot version: 7f69cd6d63595b50ebbaee3c273db486f3eb0529
12:35:33 AM: Fetching cached dependencies
12:35:33 AM: Failed to fetch cache, continuing with build
12:35:33 AM: Starting to prepare the repo for build
12:35:34 AM: No cached dependencies found. Cloning fresh repo
12:35:34 AM: git clone https://github.com/newAndLiving/website
12:35:36 AM: Preparing Git Reference refs/heads/main
12:35:36 AM: Parsing package.json dependencies
12:35:37 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'new-and-living' versus 'new-and-living/' in the Netlify UI
12:35:37 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'new-and-living/public' versus '/' in the Netlify UI
12:35:37 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'hugo --gc --minify -b $URL' versus '' in the Netlify UI
12:35:37 AM: Section completed: initializing
12:35:37 AM: Starting build script
12:35:37 AM: Installing dependencies
12:35:37 AM: Python version set to 2.7
12:35:38 AM: v16.18.1 is already installed.
12:35:38 AM: Now using node v16.18.1 (npm v8.19.2)
12:35:38 AM: Enabling node corepack
12:35:38 AM: Started restoring cached build plugins
12:35:38 AM: Finished restoring cached build plugins
12:35:38 AM: Attempting ruby version 2.7.2, read from environment
12:35:39 AM: Using ruby version 2.7.2
12:35:39 AM: Using PHP version 8.0
12:35:39 AM: Installing Hugo 0.81.0
12:35:40 AM: hugo v0.81.0-59D15C97+extended linux/amd64 BuildDate=2021-02-19T17:07:12Z VendorInfo=gohugoio
12:35:40 AM: Started restoring cached go cache
12:35:40 AM: Finished restoring cached go cache
12:35:41 AM: Installing Go version 1.19.3 (requested 1.19.x)
12:35:46 AM: unset GOOS;
12:35:46 AM: unset GOARCH;
12:35:46 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.19.3.linux.amd64';
12:35:46 AM: export PATH="/opt/buildhome/.gimme/versions/go1.19.3.linux.amd64/bin:${PATH}";
12:35:46 AM: go version >&2;
12:35:46 AM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.19.3.linux.amd64.env"
12:35:46 AM: go version go1.19.3 linux/amd64
12:35:46 AM: Detected 2 framework(s)
12:35:47 AM: null at version null
12:35:47 AM: null at version null
12:35:47 AM: Installing missing commands
12:35:47 AM: Verify run directory
12:35:48 AM: ​
12:35:48 AM: ────────────────────────────────────────────────────────────────
12:35:48 AM:   Netlify Build                                                 
12:35:48 AM: ────────────────────────────────────────────────────────────────
12:35:48 AM: ​
12:35:48 AM: ❯ Version
12:35:48 AM:   @netlify/build 28.4.4
12:35:48 AM: ​
12:35:48 AM: ❯ Flags
12:35:48 AM:   baseRelDir: true
12:35:48 AM:   buildId: 63893a40b031776f870ac4d4
12:35:48 AM:   deployId: 63893a40b031776f870ac4d6
12:35:48 AM: ​
12:35:48 AM: ❯ Current directory
12:35:48 AM:   /opt/build/repo/new-and-living
12:35:48 AM: ​
12:35:48 AM: ❯ Config file
12:35:48 AM:   /opt/build/repo/new-and-living/netlify.toml
12:35:48 AM: ​
12:35:48 AM: ❯ Context
12:35:48 AM:   production
12:35:48 AM: ​
12:35:48 AM: ────────────────────────────────────────────────────────────────
12:35:48 AM:   1. build.command from netlify.toml                            
12:35:48 AM: ────────────────────────────────────────────────────────────────
12:35:48 AM: ​
12:35:48 AM: $ hugo --gc --minify -b $URL
12:35:48 AM: Start building sites …
12:35:50 AM: ERROR 2022/12/01 23:35:50 render of "page" failed: "/opt/build/repo/new-and-living/themes/logbook/layouts/homepage/single.html:50:74": execute of template failed: template: homepage/single.html:50:74: executing "main" at <$imageFallback.RelPermalink>: undefined variable: $imageFallback
12:35:50 AM: ERROR 2022/12/01 23:35:50 render of "page" failed: "/opt/build/repo/new-and-living/themes/logbook/layouts/homepage/single.html:169:74": execute of template failed: template: homepage/single.html:169:74: executing "main" at <$imageFallback.RelPermalink>: undefined variable: $imageFallback
12:35:50 AM: ERROR 2022/12/01 23:35:50 render of "page" failed: execute of template failed: template: homepage/single.html:18:14: executing "main" at <partialCached "widgets/widget-wrapper" (dict "Widgets" $widget "Scope" .)>: error calling partialCached: execute of template failed: template: partials/widgets/widget-wrapper.html:2:4: executing "partials/widgets/widget-wrapper.html" at <partial (print "widgets/" .) $.Scope>: error calling partial: "/opt/build/repo/new-and-living/themes/logbook/layouts/partials/widgets/recent-post.html:17:63": execute of template failed: template: partials/widgets/recent-post.html:17:63: executing "partials/widgets/recent-post.html" at <$imageFallback.RelPermalink>: undefined variable: $imageFallback
12:35:50 AM: ERROR 2022/12/01 23:35:50 render of "page" failed: execute of template failed: template: homepage/single.html:18:14: executing "main" at <partialCached "widgets/widget-wrapper" (dict "Widgets" $widget "Scope" .)>: error calling partialCached: execute of template failed: template: partials/widgets/widget-wrapper.html:2:4: executing "partials/widgets/widget-wrapper.html" at <partial (print "widgets/" .) $.Scope>: error calling partial: "/opt/build/repo/new-and-living/themes/logbook/layouts/partials/widgets/recent-post.html:17:63": execute of template failed: template: partials/widgets/recent-post.html:17:63: executing "partials/widgets/recent-post.html" at <$imageFallback.RelPermalink>: undefined variable: $imageFallback
12:35:50 AM: Total in 2022 ms
12:35:50 AM: Error: Error building site: failed to render pages: render of "page" failed: "/opt/build/repo/new-and-living/themes/logbook/layouts/homepage/single.html:111:76": execute of template failed: template: homepage/single.html:111:76: executing "main" at <$imageFallback.RelPermalink>: undefined variable: $imageFallback
12:35:50 AM: ​
12:35:50 AM: ────────────────────────────────────────────────────────────────
12:35:50 AM:   "build.command" failed                                        
12:35:50 AM: ────────────────────────────────────────────────────────────────
12:35:50 AM: ​
12:35:50 AM:   Error message
12:35:50 AM:   Command failed with exit code 255: hugo --gc --minify -b $URL (https://ntl.fyi/exit-code-255)
12:35:50 AM: ​
12:35:50 AM:   Error location
12:35:50 AM:   In build.command from netlify.toml:
12:35:50 AM:   hugo --gc --minify -b $URL
12:35:50 AM: ​
12:35:50 AM:   Resolved config
12:35:50 AM:   build:
12:35:50 AM:     base: /opt/build/repo/new-and-living
12:35:50 AM:     command: hugo --gc --minify -b $URL
12:35:50 AM:     commandOrigin: config
12:35:50 AM:     environment:
12:35:50 AM:       - HUGO_VERSION
12:35:50 AM:       - HUGO_ENABLEGITINFO
12:35:50 AM:       - HUGO_ENV
12:35:50 AM:     publish: /opt/build/repo/new-and-living/public
12:35:51 AM: Creating deploy upload records
12:35:50 AM:     publishOrigin: config
12:35:50 AM: Caching artifacts
12:35:51 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:35:50 AM: Started saving build plugins
12:35:50 AM: Finished saving build plugins
12:35:50 AM: Started saving pip cache
12:35:50 AM: Finished saving pip cache
12:35:50 AM: Started saving emacs cask dependencies
12:35:50 AM: Finished saving emacs cask dependencies
12:35:50 AM: Started saving maven dependencies
12:35:50 AM: Finished saving maven dependencies
12:35:50 AM: Started saving boot dependencies
12:35:50 AM: Finished saving boot dependencies
12:35:50 AM: Started saving rust rustup cache
12:35:50 AM: Finished saving rust rustup cache
12:35:50 AM: Started saving go dependencies
12:35:50 AM: Finished saving go dependencies
12:35:51 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:35:51 AM: Failing build: Failed to build site
12:35:51 AM: Finished processing build request in 18.035364859s

In the file:

./new-and-living/themes/logbook/layouts/homepage/single.html

on line 50, column 74, you’re using a variable named imageFallback, but that variable is not defined before trying to use it. It looks like a problem with the theme that you’re using.

Thanks for helping out.

But It still deployed at 4th of November 2022, here. I wouldn’t know if I am doing something wrong.
image

Hi, @newAndLiving. Our scope of support can be found here:

Our technical support does not include the code that you write or code written by third-parties. Our technical support covers Netlify’s services and the code we write (or control).

This error is occurring in the code you write or control. The repo for this site is private. This means, even if our support team had resources to troubleshoot your code, we still could not as we cannot see your repo.

@hrishikesh, can only say where the error exists. It is up to you to fix the error as it is happening in code that only you can see and only you can change.

If you make the repo public or share the source code here in some other way, someone else on this support forum might have the resources to assist you. Again, however, our support team does not have the resources to troubleshoot the code you have written.

Thanks @hrishikesh and @luke. I have made the repo public and the link could be found here. Any help rendered will be appreciated. Thanks in advance.

Hi @newAndLiving :wave:t6: , as Luke mentioned we cannot debug your code. Now that your repo is public anyone in the forums can help with debugging your code if need be. Happy building! :rocket: