Command failed with exit code 255 | Tried all the solutions but non works

Hi, my issue is really driving me crazy

Here is deploy logs

5:21:01 PM: Build ready to start
5:21:12 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
5:21:12 PM: build-image tag: v4.10.1
5:21:12 PM: buildbot version: 7e449fda4d95fa42451b88186ca7054116649237
5:21:12 PM: Fetching cached dependencies
5:21:12 PM: Starting to download cache of 170.2MB
5:21:13 PM: Finished downloading cache in 942.314729ms
5:21:13 PM: Starting to extract cache
5:21:14 PM: Finished extracting cache in 672.893448ms
5:21:14 PM: Finished fetching cache in 1.682639902s
5:21:14 PM: Starting to prepare the repo for build
5:21:14 PM: Preparing Git Reference refs/heads/main
5:21:15 PM: Parsing package.json dependencies
5:21:15 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'hugo --gc --minify -b $URL' versus 'CI= npm run build' in the Netlify UI
5:21:15 PM: Starting build script
5:21:15 PM: Installing dependencies
5:21:15 PM: Python version set to 2.7
5:21:15 PM: Started restoring cached node version
5:21:16 PM: Finished restoring cached node version
5:21:16 PM: v16.17.0 is already installed.
5:21:17 PM: Now using node v16.17.0 (npm v8.15.0)
5:21:17 PM: Started restoring cached build plugins
5:21:17 PM: Finished restoring cached build plugins
5:21:17 PM: Attempting ruby version 2.7.2, read from environment
5:21:17 PM: Using ruby version 2.7.2
5:21:18 PM: Using PHP version 8.0
5:21:18 PM: Installing Hugo 0.97.3
5:21:18 PM: hugo v0.97.3-078053a43d746a26aa3d48cf1ec7122ae78a9bb4+extended linux/amd64 BuildDate=2022-04-18T17:22:19Z VendorInfo=gohugoio
5:21:18 PM: Started restoring cached go cache
5:21:18 PM: Finished restoring cached go cache
5:21:18 PM: Installing Go version 1.17 (requested 1.17)
5:21:22 PM: unset GOOS;
5:21:22 PM: unset GOARCH;
5:21:22 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
5:21:22 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
5:21:22 PM: go version >&2;
5:21:22 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
5:21:22 PM: go version go1.17 linux/amd64
5:21:22 PM: Installing missing commands
5:21:22 PM: Verify run directory
5:21:23 PM: ​
5:21:23 PM: ────────────────────────────────────────────────────────────────
5:21:23 PM:   Netlify Build                                                 
5:21:23 PM: ────────────────────────────────────────────────────────────────
5:21:23 PM: ​
5:21:23 PM: ❯ Version
5:21:23 PM:   @netlify/build 27.18.1
5:21:23 PM: ​
5:21:23 PM: ❯ Flags
5:21:23 PM:   baseRelDir: true
5:21:23 PM:   buildId: 6325d7cd209c690008dd0284
5:21:23 PM:   deployId: 6325d7cd209c690008dd0286
5:21:23 PM: ​
5:21:23 PM: ❯ Current directory
5:21:23 PM:   /opt/build/repo
5:21:23 PM: ​
5:21:23 PM: ❯ Config file
5:21:23 PM:   /opt/build/repo/netlify.toml
5:21:23 PM: ​
5:21:23 PM: ❯ Context
5:21:23 PM:   production
5:21:23 PM: ​
5:21:23 PM: ❯ Loading plugins
5:21:23 PM:    - netlify-plugin-hugo-cache-resources@0.2.1 from netlify.toml
5:21:24 PM: ​
5:21:24 PM: ────────────────────────────────────────────────────────────────
5:21:24 PM:   1. netlify-plugin-hugo-cache-resources (onPreBuild event)     
5:21:24 PM: ────────────────────────────────────────────────────────────────
5:21:24 PM: ​
5:21:24 PM: Checking if resources exist at "resources"
5:21:24 PM: Restored cached resources folder. Total files: 2
5:21:24 PM: ---
5:21:24 PM: 1. /opt/build/repo/resources
5:21:24 PM: 2. /opt/build/repo/resources/_gen
5:21:24 PM: ​
5:21:24 PM: (netlify-plugin-hugo-cache-resources onPreBuild completed in 45ms)
5:21:24 PM: ​
5:21:24 PM: ────────────────────────────────────────────────────────────────
5:21:24 PM:   2. build.command from netlify.toml                            
5:21:24 PM: ────────────────────────────────────────────────────────────────
5:21:24 PM: ​
5:21:24 PM: $ hugo --gc --minify -b $URL
5:21:24 PM: Start building sites …
5:21:24 PM: hugo v0.97.3-078053a43d746a26aa3d48cf1ec7122ae78a9bb4+extended linux/amd64 BuildDate=2022-04-18T17:22:19Z VendorInfo=gohugoio
5:21:24 PM: ERROR 2022/09/17 14:21:24 Brand logo not found at `assets/media/icons/brands/CC.svg`
5:21:24 PM: Error: Error building site: failed to render pages: render of "home" failed: execute of template failed: template: index.html:22:5: executing "main" at <partial "widget_page.html" .>: error calling partial: execute of template failed: template: partials/widget_page.html:151:9: executing "partials/widget_page.html" at <partial $widget_path $widget_args>: error calling partial: "/opt/build/cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5@v5.6.0/layouts/partials/widgets/experience.html:40:36": execute of template failed: template: partials/widgets/experience.html:40:36: executing "partials/widgets/experience.html" at <$svg_icon.RelPermalink>: nil pointer evaluating resource.Resource.RelPermalink
5:21:24 PM: Total in 422 ms
5:21:24 PM: ​
5:21:24 PM: ────────────────────────────────────────────────────────────────
5:21:24 PM:   "build.command" failed                                        
5:21:24 PM: ────────────────────────────────────────────────────────────────
5:21:24 PM: ​
5:21:24 PM:   Error message
5:21:25 PM: Creating deploy upload records
5:21:24 PM:   Command failed with exit code 255: hugo --gc --minify -b $URL
5:21:24 PM: ​
5:21:24 PM:   Error location
5:21:24 PM:   In build.command from netlify.toml:
5:21:24 PM:   hugo --gc --minify -b $URL
5:21:25 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
5:21:24 PM: ​
5:21:24 PM:   Resolved config
5:21:24 PM:   build:
5:21:24 PM:     command: hugo --gc --minify -b $URL
5:21:24 PM:     commandOrigin: config
5:21:24 PM:     environment:
5:21:24 PM:       - CI
5:21:24 PM:       - NPM_FLAGS
5:21:24 PM:       - HUGO_VERSION
5:21:24 PM:       - HUGO_ENABLEGITINFO
5:21:24 PM:       - HUGO_ENV
5:21:24 PM:     publish: /opt/build/repo/public
5:21:24 PM:     publishOrigin: config
5:21:24 PM:   plugins:
5:21:24 PM:     - inputs:
5:21:24 PM:         debug: true
5:21:24 PM:       origin: config
5:21:24 PM:       package: netlify-plugin-hugo-cache-resources
5:21:25 PM: Caching artifacts
5:21:25 PM: Started saving build plugins
5:21:25 PM: Finished saving build plugins
5:21:25 PM: Started saving pip cache
5:21:25 PM: Finished saving pip cache
5:21:25 PM: Started saving emacs cask dependencies
5:21:25 PM: Finished saving emacs cask dependencies
5:21:25 PM: Started saving maven dependencies
5:21:25 PM: Finished saving maven dependencies
5:21:25 PM: Started saving boot dependencies
5:21:25 PM: Finished saving boot dependencies
5:21:25 PM: Started saving rust rustup cache
5:21:25 PM: Finished saving rust rustup cache
5:21:25 PM: Started saving go dependencies
5:21:25 PM: Finished saving go dependencies
5:21:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:21:25 PM: Failing build: Failed to build site
5:21:25 PM: Finished processing build request in 13.383238903s

My repo can be found here, and website here.

Solutions I tried

The last thing I have done is that adding a new “Publication” deployed perfectly, and after that non can be deployed. I have also tied to delete it but nothing seems work.

Any help would be appreciated.

Hey @Mohana,

It appears that your site is building fine at the moment. Have you resolved this?

I pushed back my git commit, which was working fine, and now everything working perfectly.