I am getting an error whenever I try automatic deployment with GitHub

Hello. I have been trying to automatically deploy my website using GitHub. I succeeded in the manual deployment, but when I try the automatic, it fails. Is there a way to prevent this error?
Here is the deploy log:
7:49:29 PM: Build ready to start
7:49:32 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
7:49:32 PM: build-image tag: v3.4.1
7:49:32 PM: buildbot version: fcbc7a79f7372e5995cf02954ef19fc48d20c871
7:49:32 PM: Fetching cached dependencies
7:49:32 PM: Failed to fetch cache, continuing with build
7:49:32 PM: Starting to prepare the repo for build
7:49:32 PM: No cached dependencies found. Cloning fresh repo
7:49:32 PM: git clone GitHub - hhadah/website: my-website
7:49:34 PM: Preparing Git Reference refs/heads/master
7:49:35 PM: Starting build script
7:49:35 PM: Installing dependencies
7:49:35 PM: Python version set to 2.7
7:49:36 PM: v12.18.0 is already installed.
7:49:37 PM: Now using node v12.18.0 (npm v6.14.4)
7:49:37 PM: Started restoring cached build plugins
7:49:37 PM: Finished restoring cached build plugins
7:49:37 PM: Attempting ruby version 2.7.1, read from environment
7:49:38 PM: Using ruby version 2.7.1
7:49:39 PM: Using PHP version 5.6
7:49:39 PM: 5.2 is already installed.
7:49:39 PM: Using Swift version 5.2
7:49:39 PM: Started restoring cached go cache
7:49:39 PM: Finished restoring cached go cache
7:49:39 PM: go version go1.14.4 linux/amd64
7:49:39 PM: go version go1.14.4 linux/amd64
7:49:39 PM: Installing missing commands
7:49:39 PM: Verify run directory
7:49:40 PM: ​
7:49:40 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
7:49:40 PM: β”‚ Netlify Build β”‚
7:49:40 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
7:49:40 PM: ​
7:49:40 PM: ❯ Version
7:49:40 PM: @netlify/build 3.3.0
7:49:40 PM: ​
7:49:40 PM: ❯ Flags
7:49:40 PM: deployId: 5f3dc8996097b705f7688908
7:49:40 PM: mode: buildbot
7:49:40 PM: ​
7:49:40 PM: ❯ Current directory
7:49:40 PM: /opt/build/repo
7:49:40 PM: ​
7:49:40 PM: ❯ Config file
7:49:40 PM: No config file was defined: using default values.
7:49:40 PM: ​
7:49:40 PM: ❯ Context
7:49:40 PM: production
7:49:40 PM: ​
7:49:40 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
7:49:40 PM: β”‚ 1. Build command from Netlify app β”‚
7:49:40 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
7:49:40 PM: ​
7:49:40 PM: $ hugo
7:49:40 PM: Error: β€œ/opt/build/repo/themes/hugo-academic/layouts/partials/book_sidebar.html:24:1”: parse failed: template: partials/book_sidebar.html:24: illegal number syntax: β€œ-”
7:49:40 PM: ​
7:49:40 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
7:49:40 PM: β”‚ β€œbuild.command” failed β”‚
7:49:40 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
7:49:40 PM: ​
7:49:40 PM: Error message
7:49:40 PM: Command failed with exit code 255: hugo
7:49:40 PM: ​
7:49:40 PM: Error location
7:49:40 PM: In Build command from Netlify app:
7:49:40 PM: hugo
7:49:40 PM: ​
7:49:40 PM: Resolved config
7:49:40 PM: build:
7:49:40 PM: command: hugo
7:49:40 PM: commandOrigin: ui
7:49:40 PM: publish: /opt/build/repo/public
7:49:40 PM: Caching artifacts
7:49:40 PM: Started saving build plugins
7:49:40 PM: Finished saving build plugins
7:49:40 PM: Started saving pip cache
7:49:40 PM: Finished saving pip cache
7:49:40 PM: Started saving emacs cask dependencies
7:49:40 PM: Finished saving emacs cask dependencies
7:49:40 PM: Started saving maven dependencies
7:49:40 PM: Finished saving maven dependencies
7:49:40 PM: Started saving boot dependencies
7:49:41 PM: Finished saving boot dependencies
7:49:41 PM: Started saving go dependencies
7:49:41 PM: Finished saving go dependencies
7:49:43 PM: Error running command: Build script returned non-zero exit code: 1
7:49:43 PM: Failing build: Failed to build site
7:49:43 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 1
7:49:43 PM: Finished processing build request in 11.800020212s

hi there,

So it looks like this is the problem:

7:49:40 PM: $ hugo
7:49:40 PM: Error: β€œ/opt/build/repo/themes/hugo-academic/layouts/partials/book_sidebar.html:24:1”: parse failed: template: partials/book_sidebar.html:24: illegal number syntax: β€œ-”
7:49:40 PM: ​

is there something funky happening at the indicated place (24:1) in that file?

I had the same problem as @hhadah. There’s nothing suspicious at (24:1) in that file.
I suspected a problem with the Hugo version, as I use a recent version (0.74.3) locally. I solved the error by creating a netlify.toml config file with this content:

[build]
  publish = "public"
  command = "hugo"

[context.production.environment]
  HUGO_VERSION = "0.74.3"
  HUGO_ENV = "production"
  HUGO_ENABLEGITINFO = "true"
  
[context.branch-deploy.environment]
  HUGO_VERSION = "0.74.3"

[context.deploy-preview.environment]
  HUGO_VERSION = "0.74.3"
  
[context.deploy-preview]
  command = "hugo -b $DEPLOY_PRIME_URL --buildFuture"

[context.branch-deploy]
  command = "hugo -b $DEPLOY_PRIME_URL --buildFuture"

thanks for sharing, @sguyader!

Thank you for your reply and code, @sguyader.
@sguyader I created a netlify.toml file and added it to my GitHub repo and I am still getting the same error but with different files. What is weird that manual deployment is working, but the automatic one is not.

8:05:12 AM: Build ready to start

8:05:14 AM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
8:05:14 AM: build-image tag: v3.4.1
8:05:14 AM: buildbot version: fcbc7a79f7372e5995cf02954ef19fc48d20c871
8:05:15 AM: Fetching cached dependencies
8:05:15 AM: Starting to download cache of 119.7MB
8:05:16 AM: Finished downloading cache in 1.743789051s
8:05:16 AM: Starting to extract cache
8:05:20 AM: Finished extracting cache in 3.439402371s
8:05:20 AM: Finished fetching cache in 5.214984071s
8:05:20 AM: Starting to prepare the repo for build
8:05:20 AM: Preparing Git Reference refs/heads/master
8:05:22 AM: Starting build script
8:05:22 AM: Installing dependencies
8:05:22 AM: Python version set to 2.7
8:05:23 AM: Started restoring cached node version
8:05:25 AM: Finished restoring cached node version
8:05:26 AM: v12.18.0 is already installed.
8:05:26 AM: Now using node v12.18.0 (npm v6.14.4)
8:05:26 AM: Started restoring cached build plugins
8:05:26 AM: Finished restoring cached build plugins
8:05:26 AM: Attempting ruby version 2.7.1, read from environment
8:05:28 AM: Using ruby version 2.7.1
8:05:28 AM: Using PHP version 5.6
8:05:28 AM: 5.2 is already installed.
8:05:28 AM: Using Swift version 5.2
8:05:28 AM: Installing Hugo 0.74.3
8:05:28 AM: Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z
8:05:28 AM: Started restoring cached go cache
8:05:28 AM: Finished restoring cached go cache
8:05:28 AM: go version go1.14.4 linux/amd64
8:05:28 AM: go version go1.14.4 linux/amd64
8:05:28 AM: Installing missing commands
8:05:28 AM: Verify run directory
8:05:29 AM: ​
8:05:29 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
8:05:29 AM: β”‚ Netlify Build β”‚
8:05:29 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
8:05:29 AM: ​
8:05:29 AM: ❯ Version
8:05:29 AM: @netlify/build 3.3.0
8:05:29 AM: ​
8:05:29 AM: ❯ Flags
8:05:29 AM: deployId: 5f3fc6888c806400076210e3
8:05:29 AM: mode: buildbot
8:05:29 AM: ​
8:05:29 AM: ❯ Current directory
8:05:29 AM: /opt/build/repo
8:05:29 AM: ​
8:05:29 AM: ❯ Config file
8:05:29 AM: No config file was defined: using default values.
8:05:29 AM: ​
8:05:29 AM: ❯ Context
8:05:29 AM: production
8:05:29 AM: ​
8:05:29 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
8:05:29 AM: β”‚ 1. Build command from Netlify app β”‚
8:05:29 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
8:05:29 AM: ​
8:05:29 AM: $ hugo
8:05:30 AM: Building sites … ERROR 2020/08/21 13:05:30 render of β€œsection” failed: execute of template failed: template: section/publication.html:65:15: executing β€œmain” at <partial β€œli_citation” .>: error calling partial: execute of template failed: template: partials/li_citation.html:17:8: executing β€œpartials/li_citation.html” at <partial β€œpage_links” (dict β€œpage” . β€œis_list” 1)>: error calling partial: β€œ/opt/build/repo/themes/hugo-academic/layouts/partials/page_links.html:62:14”: execute of template failed: template: partials/page_links.html:62:14: executing β€œpartials/page_links.html” at <$page.Params.projects>: range can’t iterate over internal-project
Total in 804 ms
8:05:30 AM: Error: Error building site: failed to render pages: render of β€œpage” failed: execute of template failed: template: publication/single.html:5:5: executing β€œmain” at <partial β€œpage_header.html” .>: error calling partial: execute of template failed: template: partials/page_header.html:64:5: executing β€œpartials/page_header.html” at <partial β€œpage_links_div.html” $page>: error calling partial: execute of template failed: template: partials/page_links_div.html:23:5: executing β€œpartials/page_links_div.html” at <partial β€œpage_links” (dict β€œpage” $page β€œis_list” 0)>: error calling partial: β€œ/opt/build/repo/themes/hugo-academic/layouts/partials/page_links.html:62:14”: execute of template failed: template: partials/page_links.html:62:14: executing β€œpartials/page_links.html” at <$page.Params.projects>: range can’t iterate over internal-project
​
8:05:30 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
8:05:30 AM: β”‚ β€œbuild.command” failed β”‚
8:05:30 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
8:05:30 AM: ​
8:05:30 AM: Error message
8:05:30 AM: Command failed with exit code 255: hugo
8:05:30 AM: ​
8:05:30 AM: Error location
8:05:30 AM: In Build command from Netlify app:
8:05:30 AM: hugo
8:05:30 AM: ​
8:05:30 AM: Resolved config
8:05:30 AM: build:
8:05:30 AM: command: hugo
8:05:30 AM: commandOrigin: ui
8:05:30 AM: environment:
8:05:30 AM: - HUGO_VERSION
8:05:30 AM: publish: /opt/build/repo/public
8:05:30 AM: Caching artifacts
8:05:30 AM: Started saving build plugins
8:05:30 AM: Finished saving build plugins
8:05:30 AM: Started saving pip cache
8:05:31 AM: Finished saving pip cache
8:05:31 AM: Started saving emacs cask dependencies
8:05:31 AM: Finished saving emacs cask dependencies
8:05:31 AM: Started saving maven dependencies
8:05:31 AM: Finished saving maven dependencies
8:05:31 AM: Started saving boot dependencies
8:05:31 AM: Finished saving boot dependencies
8:05:31 AM: Started saving go dependencies
8:05:31 AM: Finished saving go dependencies
8:05:31 AM: Error running command: Build script returned non-zero exit code: 1
8:05:31 AM: Failing build: Failed to build site
8:05:31 AM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 1
8:05:31 AM: Finished processing build request in 16.288307632s

1 Like

not weird at all that manual and automatic deployments are differently behaving; they are 100% different processes:

  • automatic requires that we can build your site
  • manual requires that YOU can build your site and we never try to build anything

I’d take a step back and ensure that you can build locally from a CLEAN checkout of your repo, and confirm what version of hugo you are using locally and make sure ours is the same.

This article describes those and other β€œcommon” debugging processes which we’ll need you to try before our staff takes a swing at it in case they don’t help: