Netlify build returned non-zero exit code: 255

I need advice to debug deploy Netlify App

I am facing the issue:

Repository: https://github.com/wasim-ullah/brightin
Deployment: https://suspicious-pare-9c023f.netlify.com/

Log:

12:43:45 AM: Build ready to start
12:43:50 AM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
12:43:50 AM: build-image tag: v3.3.2
12:43:50 AM: buildbot version: a2bab682ae0761baa4d123ebd00c57be933655dc
12:43:51 AM: Fetching cached dependencies
12:43:51 AM: Starting to download cache of 84.2MB
12:43:51 AM: Finished downloading cache in 573.419206ms
12:43:51 AM: Starting to extract cache
12:43:54 AM: Finished extracting cache in 3.082664527s
12:43:54 AM: Finished fetching cache in 3.719570662s
12:43:54 AM: Starting to prepare the repo for build
12:43:55 AM: Preparing Git Reference refs/heads/master
12:43:55 AM: Starting build script
12:43:55 AM: Installing dependencies
12:43:56 AM: Started restoring cached node version
12:43:58 AM: Finished restoring cached node version
12:43:59 AM: v10.17.0 is already installed.
12:44:00 AM: Now using node v10.17.0 (npm v6.11.3)
12:44:01 AM: Attempting ruby version 2.6.2, read from environment
12:44:02 AM: Using ruby version 2.6.2
12:44:03 AM: Using PHP version 5.6
12:44:03 AM: Started restoring cached go cache
12:44:03 AM: Finished restoring cached go cache
12:44:03 AM: unset GOOS;
12:44:03 AM: unset GOARCH;
12:44:03 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
12:44:03 AM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
12:44:03 AM: go version >&2;
12:44:03 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
12:44:03 AM: go version go1.12 linux/amd64
12:44:03 AM: Installing missing commands
12:44:03 AM: Verify run directory
12:44:03 AM: Executing user command: hugo
12:44:03 AM: Error: Unable to find theme Directory: /opt/build/repo/themes/hugonews
12:44:03 AM: Skipping functions preparation step: no functions directory set
12:44:03 AM: Caching artifacts
12:44:03 AM: Started saving pip cache
12:44:03 AM: Finished saving pip cache
12:44:03 AM: Started saving emacs cask dependencies
12:44:03 AM: Finished saving emacs cask dependencies
12:44:03 AM: Started saving maven dependencies
12:44:03 AM: Finished saving maven dependencies
12:44:03 AM: Started saving boot dependencies
12:44:03 AM: Finished saving boot dependencies
12:44:03 AM: Started saving go dependencies
12:44:03 AM: Finished saving go dependencies
12:44:03 AM: Error running command: Build script returned non-zero exit code: 255
12:44:03 AM: failed during stage 'building site': Build script returned non-zero exit code: 255
12:44:03 AM: Failing build: Failed to build site
12:44:03 AM: Finished processing build request in 12.504986878s

Please share your recommendations.

Hi! We always recommend a quick search of our forums if you haven’t done so already.

Is this post relevant?

1 Like

Yes, it is. Thank you

1 Like

Hi All, I am getting the same error. I have followed the instructions here and it still failing to deploy my website. Here is the log:

6:42:33 PM: Waiting for other deploys from your team to complete. Check the queue: https://app.netlify.com/teams/dylan-padilla94/builds
6:42:36 PM: Build ready to start
6:42:38 PM: build-image version: 6ac9cdbcc295289dbaea7d39b2f1a3ac25ad3380 (xenial)
6:42:38 PM: build-image tag: release-v3.14.0
6:42:38 PM: buildbot version: 0d1cf41e4e345a224c39ab2a783aa4af5c76f6e8
6:42:38 PM: Fetching cached dependencies
6:42:38 PM: Starting to download cache of 960.6MB
6:42:41 PM: Finished downloading cache in 2.91986986s
6:42:41 PM: Starting to extract cache
6:42:52 PM: Finished extracting cache in 11.358309952s
6:42:52 PM: Finished fetching cache in 14.406234845s
6:42:52 PM: Starting to prepare the repo for build
6:42:52 PM: Preparing Git Reference refs/heads/master
6:42:55 PM: Parsing package.json dependencies
6:42:56 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'hugo' versus 'CI=npm run build' in the Netlify UI
6:42:56 PM: Starting build script
6:42:56 PM: Installing dependencies
6:42:56 PM: Python version set to 2.7
6:42:57 PM: Started restoring cached node version
6:42:58 PM: Finished restoring cached node version
6:42:59 PM: v8.17.0 is already installed.
6:42:59 PM: Now using node v8.17.0 (npm v6.13.4)
6:42:59 PM: Started restoring cached build plugins
6:42:59 PM: Finished restoring cached build plugins
6:42:59 PM: Attempting ruby version 2.3.6, read from environment
6:43:00 PM: Started restoring cached ruby version
6:43:00 PM: Finished restoring cached ruby version
6:43:01 PM: Using ruby version 2.3.6
6:43:02 PM: Successfully installed bundler-2.3.18
6:43:02 PM: 1 gem installed
6:43:02 PM: Using PHP version 5.6
6:43:02 PM: Installing Hugo 0.49
6:43:02 PM: Hugo Static Site Generator v0.49/extended linux/amd64 BuildDate: 2018-09-24T10:34:30Z
6:43:02 PM: Started restoring cached go cache
6:43:03 PM: Finished restoring cached go cache
6:43:03 PM: Installing Go version 1.10
6:43:03 PM: unset GOOS;
6:43:03 PM: unset GOARCH;
6:43:03 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.10.linux.amd64';
6:43:03 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.10.linux.amd64/bin:${PATH}";
6:43:03 PM: go version >&2;
6:43:03 PM: export GIMME_ENV='/opt/buildhome/.gimme_cache/env/go1.10.linux.amd64.env';
6:43:03 PM: go version go1.10 linux/amd64
6:43:03 PM: Installing missing commands
6:43:03 PM: Verify run directory
6:43:05 PM: ​
6:43:05 PM: ────────────────────────────────────────────────────────────────
6:43:05 PM:   Netlify Build                                                 
6:43:05 PM: ────────────────────────────────────────────────────────────────
6:43:05 PM: ​
6:43:05 PM: ❯ Version
6:43:05 PM:   @netlify/build 27.3.4
6:43:05 PM: ​
6:43:05 PM: ❯ Flags
6:43:05 PM:   baseRelDir: false
6:43:05 PM:   buildId: 62d369093aae827a01e7e108
6:43:05 PM:   deployId: 62d369093aae827a01e7e10a
6:43:05 PM: ​
6:43:05 PM: ❯ Current directory
6:43:05 PM:   /opt/build/repo
6:43:05 PM: ​
6:43:05 PM: ❯ Config file
6:43:05 PM:   /opt/build/repo/netlify.toml
6:43:05 PM: ​
6:43:05 PM: ❯ Context
6:43:05 PM:   production
6:43:05 PM: ​
6:43:05 PM: ────────────────────────────────────────────────────────────────
6:43:05 PM:   1. build.command from netlify.toml                            
6:43:05 PM: ────────────────────────────────────────────────────────────────
6:43:05 PM: ​
6:43:05 PM: $ hugo
6:43:05 PM: Building sites … ERROR 2022/07/17 01:43:05 Failed to render "section/talk.html": runtime error: index out of range
6:43:05 PM: ERROR 2022/07/17 01:43:05 Stack Trace:
6:43:05 PM: goroutine 188 [running]:
6:43:05 PM: github.com/gohugoio/hugo/hugolib.stackTrace(0x4b0, 0x114c8ee, 0x17)
6:43:05 PM: 	/hugo/hugolib/page.go:285 +0x76
6:43:05 PM: github.com/gohugoio/hugo/hugolib.(*Site).renderForLayouts.func1(0xc000f6f7d0, 0xc0000be300)
6:43:05 PM: 	/hugo/hugolib/site.go:1741 +0x135
6:43:05 PM: panic(0x1019800, 0x1c51660)
6:43:05 PM: 	/usr/local/go/src/runtime/panic.go:513 +0x1b9
6:43:05 PM: text/template.errRecover(0xc000f6f6c0)
6:43:05 PM: 	/usr/local/go/src/text/template/exec.go:160 +0x1d0
6:43:05 PM: panic(0x1019800, 0x1c51660)
6:43:05 PM: 	/usr/local/go/src/runtime/panic.go:513 +0x1b9
6:43:05 PM: github.com/gohugoio/hugo/hugolib.Pages.groupByDateField(0xc00086e070, 0x1, 0x1, 0xc000de2260, 0xc000de0270, 0x1cea128, 0x0, 0x0, 0x6db6db6db6db, 0x8, ...)
6:43:05 PM: 	/hugo/hugolib/pageGroup.go:214 +0x8c1
6:43:06 PM: Creating deploy upload records
6:43:05 PM: github.com/gohugoio/hugo/hugolib.Pages.GroupByParamDate(0xc00086e070, 0x1, 0x1, 0xc0001f6586, 0xa, 0xc0001f6593, 0x4, 0x1cea128, 0x0, 0x0, ...)
6:43:05 PM: 	/hugo/hugolib/pageGroup.go:297 +0x134
6:43:05 PM: reflect.Value.call(0x10e2d60, 0xc000a328c0, 0x3a93, 0x10fe237, 0x4, 0xc000de01e0, 0x3, 0x2, 0x10f2aa0, 0x1021901, ...)
6:43:05 PM: 	/usr/local/go/src/reflect/value.go:447 +0x449
6:43:05 PM: reflect.Value.Call(0x10e2d60, 0xc000a328c0, 0x3a93, 0xc000de01e0, 0x2, 0x2, 0x1340e00, 0xc00068de40, 0xfcdd40)
6:43:06 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:43:05 PM: 	/usr/local/go/src/reflect/value.go:308 +0xa4
6:43:05 PM: text/t
6:43:05 PM: ​
6:43:05 PM: ────────────────────────────────────────────────────────────────
6:43:05 PM:   "build.command" failed                                        
6:43:05 PM: ────────────────────────────────────────────────────────────────
6:43:05 PM: ​
6:43:05 PM:   Error message
6:43:05 PM:   Command failed with exit code 255: hugo (https://ntl.fyi/exit-code-255)
6:43:05 PM: ​
6:43:05 PM:   Error location
6:43:05 PM:   In build.command from netlify.toml:
6:43:05 PM:   hugo
6:43:05 PM: ​
6:43:05 PM:   Resolved config
6:43:05 PM:   build:
6:43:05 PM:     command: hugo
6:43:05 PM:     commandOrigin: config
6:43:05 PM:     environment:
6:43:05 PM:       - CI
6:43:05 PM:       - HUGO_VERSION
6:43:05 PM:       - HUGO_ENV
6:43:05 PM:     publish: /opt/build/repo/public
6:43:05 PM:     publishOrigin: config
6:43:05 PM: Caching artifacts
6:43:05 PM: Started saving build plugins
6:43:05 PM: Finished saving build plugins
6:43:05 PM: Started saving pip cache
6:43:05 PM: Finished saving pip cache
6:43:05 PM: Started saving emacs cask dependencies
6:43:05 PM: Finished saving emacs cask dependencies
6:43:05 PM: Started saving maven dependencies
6:43:05 PM: Finished saving maven dependencies
6:43:05 PM: Started saving boot dependencies
6:43:05 PM: Finished saving boot dependencies
6:43:05 PM: Started saving rust rustup cache
6:43:05 PM: Finished saving rust rustup cache
6:43:05 PM: Started saving go dependencies
6:43:06 PM: Finished saving go dependencies
6:43:06 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:43:06 PM: Failing build: Failed to build site
6:43:06 PM: Finished processing build request in 28.896033774s

This is my repo:

https://github.com/Dylan-Padilla/website

I do not have a deep understanding of the log in netlify, sorry if the question is silly. Can someone help me solve this problem?

Thanks in advance!

The error says, index out of range. Check this out:

Hi @hrishikesh, thanks for your response. I checked that case but I am not sure it has what I need to fix my problem. Can you be more specific so I can try to solve my problem? I have tried some stuff like changing the Build command from the deploy settings. Also, I have changed the Environment variable and it has not worked. Any idea? thanks for your time!

Hi @Dylan-Padilla,

Are you using Windows Subsystem for Linux (WSL) on Windows? If so, then the last comment from the post that Hrishikesh mentioned may help:

I have solved: if you use WSL on windows you must run docsy not on a mounted windows folder, you must use a Linux one.

Hi @Melvin, thanks for your response. I am sorry, I should have specified the operating system.

I am using OS Catalina 10.15.7 (Darwin Kernel Version 19.6.0: Tue Feb 15 21:39:11 PST 2022; root:xnu-6153.141.59~1/RELEASE_X86_64 x86_64, lsb_release). Does this help?

As I mentioned before, I checked Hrishikesh’s suggestion but I do not think it has the solution for my problem (or maybe I am wrong and need a little bit of clarification to fix this). This error is weird to me because a month ago or so I could deploy the website with the exact same settings and I did not see any problems. This time all I did was include a link in the content/talk.md file of the website and that error came out all of a sudden. In addition, I did remove the link and the error kept showing up, so it should be something related to the settings on Netlify. What do you think?

:wave: hey there, @Dylan-Padilla

Thanks for following up. I see that you have shared a link to your repo, can you also share a link to your site as well?

Hi @hillary, thanks for your reply.

Sure, here is the link of my website: https://dylanpadilla.netlify.app/

One more important detail: I use R to render the website locally, using blogdown::serve_site(). After modifying my files locally, I just drag them to my Github repository and then Netlify automatically deploys the website. In this case, I can render/deploy the website locally using R and it works okay, but Netlify fails to deploy it. So, like I said before, I think this should be something related to the settings on Netlify. Any help?

Hi All, I just found a strange solution to the problem. The second line of the file content/talk/presentation-evo-2022.md is the date on which the page is supposed to publish the content of that file. If that date already passed, netlify would not deploy the website due to the following error: Building sites … ERROR 2022/07/19 05:41:35 Failed to render "section/talk.html": runtime error: index out of range. I randomly changed that date to 2022-07-19T10:50:00 and netlify deployed the website with no problems. I do not know if that makes sense, because if I want to update my website, now I need to modify the date of that file so netlify does not give me any error.

Here is a Twitter thread that made me play with that date to solve the problem: index out of range.

Hey there, @Dylan-Padilla :wave:

Thanks so much for reporting back with this solution! This will definitely be helpful for future explorers who encounter something similar.

Happy building!

Hello, I am new to Netlify and Hugo themes. I am having the Error message
10:28:43 PM: Command failed with exit code 255: hugo (Search results for '"non-zero exit code: 255"' - Netlify Support Forums)
with Error location In build.command from netlify.toml:
hugo

In my content/week/_index.md file I set the draft from draft: false to draft: true, so it would not show on the web page until I completed the content. I then changed back to draft: false, but nothing deploys nor does anything shows up on the webpage. any help would be appreciated on this matter. thank you.