Home
Support Forums

Error Build script returned non-zero exit code: 2

Hi all, I can’t build the site due to this error: Build script returned non-zero exit code: 2

Here’s my deployment details. Note that i replaced my site name with in this deployment details

11:55:21 PM: Build ready to start
11:55:23 PM: build-image version: fd3b56fcdbaad56e70919e8a4b2da9b411ec3532 (xenial)
11:55:23 PM: build-image tag: v3.10.1
11:55:23 PM: buildbot version: 8b4b13a586b9f817ab478c0c44a476554bc16a2f
11:55:23 PM: Fetching cached dependencies
11:55:23 PM: Starting to download cache of 180.3MB
11:55:24 PM: Finished downloading cache in 1.076179625s
11:55:24 PM: Starting to extract cache
11:55:29 PM: Finished extracting cache in 4.701533656s
11:55:29 PM: Finished fetching cache in 5.822379982s
11:55:29 PM: Starting to prepare the repo for build
11:55:29 PM: Preparing Git Reference refs/heads/main
11:55:31 PM: Parsing package.json dependencies
11:55:31 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: '_site' versus '' in the Netlify UI
11:55:31 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'jekyll build --trace' versus '' in the Netlify UI
11:55:31 PM: Starting build script
11:55:31 PM: Installing dependencies
11:55:31 PM: Python version set to 2.7
11:55:32 PM: Started restoring cached node version
11:55:35 PM: Finished restoring cached node version
11:55:35 PM: v12.18.0 is already installed.
11:55:36 PM: Now using node v12.18.0 (npm v6.14.4)
11:55:36 PM: Started restoring cached build plugins
11:55:36 PM: Finished restoring cached build plugins
11:55:36 PM: Attempting ruby version 2.7.1, read from environment
11:55:37 PM: Started restoring cached ruby version
11:55:37 PM: Finished restoring cached ruby version
11:55:39 PM: Using ruby version 2.7.1
11:55:40 PM: Using PHP version 5.6
11:55:40 PM: Started restoring cached ruby gems
11:55:40 PM: Finished restoring cached ruby gems
11:55:40 PM: Installing gem bundle
11:55:40 PM: [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path '/opt/build/cache/bundle'`, and stop using this flag
11:55:40 PM: [DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs`
11:55:43 PM: Fetching gem metadata from https://rubygems.org/...........
11:55:43 PM: Fetching gem metadata from https://rubygems.org/.
11:55:43 PM: Resolving dependencies....
11:55:43 PM: Using concurrent-ruby 1.1.9
11:55:43 PM: Using i18n 0.9.5
11:55:43 PM: Using minitest 5.14.4
11:55:43 PM: Using thread_safe 0.3.6
11:55:43 PM: Using tzinfo 1.2.9
11:55:43 PM: Using zeitwerk 2.5.1
11:55:43 PM: Using activesupport 6.0.4.1
11:55:43 PM: Using public_suffix 4.0.6
11:55:43 PM: Using addressable 2.8.0
11:55:43 PM: Using bundler 2.1.4
11:55:43 PM: Using coffee-script-source 1.11.1
11:55:43 PM: Using execjs 2.8.1
11:55:43 PM: Using coffee-script 2.4.1
11:55:43 PM: Using colorator 1.1.0
11:55:43 PM: Using ruby-enum 0.9.0
11:55:43 PM: Using commonmarker 0.17.13
11:55:43 PM: Using unf_ext 0.0.8
11:55:43 PM: Using unf 0.1.4
11:55:43 PM: Using simpleidn 0.2.1
11:55:43 PM: Using dnsruby 1.61.7
11:55:43 PM: Using eventmachine 1.2.7
11:55:43 PM: Using http_parser.rb 0.8.0
11:55:43 PM: Using em-websocket 0.5.3
11:55:43 PM: Using ffi 1.15.4
11:55:43 PM: Using ethon 0.15.0
11:55:43 PM: Using faraday-em_http 1.0.0
11:55:43 PM: Using faraday-em_synchrony 1.0.0
11:55:43 PM: Using faraday-excon 1.1.0
11:55:43 PM: Using faraday-httpclient 1.0.1
11:55:43 PM: Using faraday-net_http 1.0.1
11:55:43 PM: Using faraday-net_http_persistent 1.2.0
11:55:43 PM: Using faraday-patron 1.0.0
11:55:43 PM: Using faraday-rack 1.0.0
11:55:43 PM: Using multipart-post 2.1.1
11:55:43 PM: Using ruby2_keywords 0.0.5
11:55:43 PM: Using faraday 1.8.0
11:55:43 PM: Using forwardable-extended 2.6.0
11:55:43 PM: Using gemoji 3.0.1
11:55:43 PM: Using sawyer 0.8.2
11:55:43 PM: Using octokit 4.21.0
11:55:43 PM: Using typhoeus 1.4.0
11:55:43 PM: Using github-pages-health-check 1.17.9
11:55:43 PM: Using rb-fsevent 0.11.0
11:55:43 PM: Using rb-inotify 0.10.1
11:55:43 PM: Using sass-listen 4.0.0
11:55:43 PM: Using sass 3.7.4
11:55:43 PM: Using jekyll-sass-converter 1.5.2
11:55:43 PM: Using listen 3.7.0
11:55:43 PM: Using jekyll-watch 2.2.1
11:55:43 PM: Using rexml 3.2.5
11:55:43 PM: Using kramdown 2.3.1
11:55:43 PM: Using liquid 4.0.3
11:55:43 PM: Using mercenary 0.3.6
11:55:43 PM: Using pathutil 0.16.2
11:55:43 PM: Using rouge 3.26.0
11:55:43 PM: Using safe_yaml 1.0.5
11:55:43 PM: Using jekyll 3.9.0
11:55:43 PM: Using jekyll-avatar 0.7.0
11:55:43 PM: Using jekyll-coffeescript 1.1.1
11:55:43 PM: Using jekyll-commonmark 1.3.1
11:55:43 PM: Using jekyll-commonmark-ghpages 0.1.6
11:55:43 PM: Using jekyll-default-layout 0.1.4
11:55:43 PM: Using jekyll-feed 0.15.1
11:55:43 PM: Using jekyll-gist 1.5.0
11:55:43 PM: Using jekyll-github-metadata 2.13.0
11:55:43 PM: Using mini_portile2 2.6.1
11:55:43 PM: Using racc 1.6.0
11:55:43 PM: Using nokogiri 1.12.5 (x86_64-linux)
11:55:43 PM: Using html-pipeline 2.14.0
11:55:43 PM: Using jekyll-mentions 1.6.0
11:55:43 PM: Using jekyll-optional-front-matter 0.3.2
11:55:43 PM: Using jekyll-paginate 1.1.0
11:55:43 PM: Using jekyll-readme-index 0.3.0
11:55:43 PM: Using jekyll-redirect-from 0.16.0
11:55:43 PM: Using jekyll-relative-links 0.6.1
11:55:43 PM: Using rubyzip 2.3.2
11:55:43 PM: Using jekyll-remote-theme 0.4.3
11:55:43 PM: Using jekyll-seo-tag 2.7.1
11:55:43 PM: Using jekyll-sitemap 1.4.0
11:55:43 PM: Using jekyll-swiss 1.0.0
11:55:43 PM: Using jekyll-theme-architect 0.2.0
11:55:43 PM: Using jekyll-theme-cayman 0.2.0
11:55:43 PM: Using jekyll-theme-dinky 0.2.0
11:55:43 PM: Using jekyll-theme-hacker 0.2.0
11:55:43 PM: Using jekyll-theme-leap-day 0.2.0
11:55:43 PM: Using jekyll-theme-merlot 0.2.0
11:55:43 PM: Using jekyll-theme-midnight 0.2.0
11:55:43 PM: Using jekyll-theme-minimal 0.2.0
11:55:43 PM: Using jekyll-theme-modernist 0.2.0
11:55:43 PM: Using jekyll-theme-primer 0.6.0
11:55:43 PM: Using jekyll-theme-slate 0.2.0
11:55:43 PM: Using jekyll-theme-tactile 0.2.0
11:55:43 PM: Using jekyll-theme-time-machine 0.2.0
11:55:43 PM: Using jekyll-titles-from-headings 0.5.3
11:55:43 PM: Using jemoji 0.12.0
11:55:43 PM: Using kramdown-parser-gfm 1.1.0
11:55:43 PM: Using minima 2.5.1
11:55:43 PM: Using unicode-display_width 1.8.0
11:55:43 PM: Using terminal-table 1.8.0
11:55:43 PM: Using github-pages 221
11:55:43 PM: Using jekyll-target-blank 2.0.0
11:55:43 PM: Bundle complete! 2 Gemfile dependencies, 101 gems now installed.
11:55:43 PM: Bundled gems are installed into `/opt/build/cache/bundle`
11:55:43 PM: Gem bundle installed
11:55:44 PM: Started restoring cached go cache
11:55:44 PM: Finished restoring cached go cache
11:55:44 PM: go version go1.14.4 linux/amd64
11:55:44 PM: go version go1.14.4 linux/amd64
11:55:44 PM: Installing missing commands
11:55:44 PM: Verify run directory
11:55:45 PM: ​
11:55:45 PM: ────────────────────────────────────────────────────────────────
11:55:45 PM:   Netlify Build                                                 
11:55:45 PM: ────────────────────────────────────────────────────────────────
11:55:45 PM: ​
11:55:45 PM: ❯ Version
11:55:45 PM:   @netlify/build 18.22.0
11:55:45 PM: ​
11:55:45 PM: ❯ Flags
11:55:45 PM:   baseRelDir: true
11:55:45 PM:   buildId: 618fdfe98f3a9100077e5efc
11:55:45 PM:   deployId: 618fdfe98f3a9100077e5efe
11:55:45 PM: ​
11:55:45 PM: ❯ Current directory
11:55:45 PM:   /opt/build/repo
11:55:45 PM: ​
11:55:45 PM: ❯ Config file
11:55:45 PM:   /opt/build/repo/netlify.toml
11:55:45 PM: ​
11:55:45 PM: ❯ Context
11:55:45 PM:   production
11:55:45 PM: ​
11:55:45 PM: ────────────────────────────────────────────────────────────────
11:55:45 PM:   1. build.command from netlify.toml                            
11:55:45 PM: ────────────────────────────────────────────────────────────────
11:55:45 PM: ​
11:55:45 PM: $ jekyll build --trace
11:55:46 PM: Configuration file: /opt/build/repo/_config.yml
11:55:46 PM:             Source: /opt/build/repo
11:55:46 PM:        Destination: /opt/build/repo/_site
11:55:46 PM:  Incremental build: disabled. Enable with --incremental
11:55:46 PM:       Generating...
11:55:46 PM: /opt/buildhome/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): "https://<mywebsiteurl>.com/changelog/\\n" (URI::InvalidURIError)
	from /opt/buildhome/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/uri/rfc3986_parser.rb:73:in `parse'
	from /opt/buildhome/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/uri/common.rb:234:in `parse'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-target-blank-2.0.0/lib/jekyll-target-blank.rb:196:in `external?'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-target-blank-2.0.0/lib/jekyll-target-blank.rb:92:in `processable_link?'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-target-blank-2.0.0/lib/jekyll-target-blank.rb:78:in `block in process_anchor_tags'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-target-blank-2.0.0/lib/jekyll-target-blank.rb:77:in `process_anchor_tags'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-target-blank-2.0.0/lib/jekyll-target-blank.rb:65:in `process_html'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-target-blank-2.0.0/lib/jekyll-target-blank.rb:35:in `process'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-target-blank-2.0.0/lib/jekyll-target-blank.rb:335:in `block in <top (required)>'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/hooks.rb:103:in `block in trigger'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/hooks.rb:102:in `each'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/hooks.rb:102:in `trigger'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/page.rb:180:in `trigger_hooks'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/site.rb:480:in `render_regenerated'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/site.rb:472:in `block in render_pages'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/site.rb:471:in `each'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/site.rb:471:in `render_pages'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/site.rb:192:in `render'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/site.rb:71:in `process'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/command.rb:28:in `process_site'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:65:in `build'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:36:in `process'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	from /opt/build/cache/bundle/ruby/2.7.0/gems/jekyll-3.9.0/exe/jekyll:15:in `<top (required)>'
	from /opt/build/cache/binstubs/jekyll:29:in `load'
	from /opt/build/cache/binstubs/jekyll:29:in `<main>'
​
11:55:46 PM: ────────────────────────────────────────────────────────────────
11:55:46 PM:   "build.command" failed                                        
11:55:46 PM: ────────────────────────────────────────────────────────────────
11:55:46 PM: ​
11:55:46 PM:   Error message
11:55:46 PM:   Command failed with exit code 1: jekyll build --trace
11:55:46 PM: ​
11:55:46 PM:   Error location
11:55:46 PM:   In build.command from netlify.toml:
11:55:46 PM:   jekyll build --trace
11:55:46 PM: ​
11:55:46 PM:   Resolved config
11:55:46 PM:   build:
11:55:46 PM:     command: jekyll build --trace
11:55:46 PM:     commandOrigin: config
11:55:46 PM:     publish: /opt/build/repo/_site
11:55:46 PM:     publishOrigin: config
11:55:47 PM: Caching artifacts
11:55:47 PM: Started saving ruby gems
11:55:47 PM: Finished saving ruby gems
11:55:47 PM: Started saving build plugins
11:55:47 PM: Finished saving build plugins
11:55:47 PM: Started saving pip cache
11:55:47 PM: Finished saving pip cache
11:55:47 PM: Started saving emacs cask dependencies
11:55:47 PM: Finished saving emacs cask dependencies
11:55:47 PM: Started saving maven dependencies
11:55:47 PM: Finished saving maven dependencies
11:55:47 PM: Started saving boot dependencies
11:55:47 PM: Finished saving boot dependencies
11:55:47 PM: Started saving rust rustup cache
11:55:47 PM: Finished saving rust rustup cache
11:55:47 PM: Started saving go dependencies
11:55:47 PM: Finished saving go dependencies
11:55:47 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:55:47 PM: Creating deploy upload records
11:55:47 PM: Failing build: Failed to build site
11:55:47 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
11:55:47 PM: Finished processing build request in 24.376058693s

It seems like, you’ve used an incorrect URL somewhere in your code.