Home
Support Forums

Problem with Hugo Academic build?

Hi all,
Started a new Github-stored Netlify deploy using Hugo Academic and it ran fine a few times, now I’m getting failed deploys and it looks as though it is linked to a problem with the path going to “public” folder or something with one of the publication pages built using Academic. Any thoughts where I should start? Thanks

Build log:
12:03:08 AM: Build ready to start
12:12:57 AM: build-image version: 653805ca4a64301556e56dc4b321ef8fc20cbb7c
12:12:57 AM: build-image tag: v3.8.2
12:12:57 AM: buildbot version: 5ca46ad10ed1b3bf6d683d62872e59029498e5a4
12:12:57 AM: Fetching cached dependencies
12:12:57 AM: Starting to download cache of 159.7MB
12:12:59 AM: Finished downloading cache in 1.289637813s
12:12:59 AM: Starting to extract cache
12:13:02 AM: Finished extracting cache in 3.152818299s
12:13:02 AM: Finished fetching cache in 4.483148002s
12:13:02 AM: Starting to prepare the repo for build
12:13:03 AM: Preparing Git Reference refs/heads/master
12:13:05 AM: Parsing package.json dependencies
12:13:06 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘public’ versus ‘/’ in the Netlify UI
12:13:06 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:13:06 AM: Starting build script
12:13:06 AM: Installing dependencies
12:13:06 AM: Python version set to 2.7
12:13:06 AM: Started restoring cached node version
12:13:09 AM: Finished restoring cached node version
12:13:10 AM: v12.18.0 is already installed.
12:13:10 AM: Now using node v12.18.0 (npm v6.14.4)
12:13:10 AM: Started restoring cached build plugins
12:13:10 AM: Finished restoring cached build plugins
12:13:10 AM: Attempting ruby version 2.7.2, read from environment
12:13:12 AM: Using ruby version 2.7.2
12:13:12 AM: Using PHP version 5.6
12:13:12 AM: Installing Hugo 0.84.4
12:13:12 AM: hugo v0.84.4-020E4ACE+extended linux/amd64 BuildDate=2021-07-01T11:51:55Z VendorInfo=gohugoio
12:13:12 AM: Started restoring cached go cache
12:13:12 AM: Finished restoring cached go cache
12:13:12 AM: go version go1.14.4 linux/amd64
12:13:12 AM: go version go1.14.4 linux/amd64
12:13:12 AM: Installing missing commands
12:13:12 AM: Verify run directory
12:13:13 AM: ​
12:13:13 AM: ────────────────────────────────────────────────────────────────
12:13:13 AM: Netlify Build
12:13:13 AM: ────────────────────────────────────────────────────────────────
12:13:13 AM: ​
12:13:13 AM: ❯ Version
12:13:13 AM: @netlify/build 16.2.1
12:13:13 AM: ​
12:13:13 AM: ❯ Flags
12:13:13 AM: deployId: 60fe5e2c2fddf9c9af3ea853
12:13:13 AM: ​
12:13:13 AM: ❯ Current directory
12:13:13 AM: /opt/build/repo
12:13:13 AM: ​
12:13:13 AM: ❯ Config file
12:13:13 AM: /opt/build/repo/netlify.toml
12:13:13 AM: ​
12:13:13 AM: ❯ Context
12:13:13 AM: production
12:13:13 AM: ​
12:13:13 AM: ❯ Loading plugins
12:13:13 AM: - netlify-plugin-hugo-cache-resources@0.2.1 from netlify.toml
12:13:13 AM: ​
12:13:13 AM: ──────────────────────────────────────────────────────────────────
12:13:13 AM: 1. onPreBuild command from netlify-plugin-hugo-cache-resources
12:13:13 AM: ──────────────────────────────────────────────────────────────────
12:13:13 AM: ​
12:13:14 AM: Checking if resources exist at “resources”
12:13:14 AM: Restored cached resources folder. Total files: 2
12:13:14 AM: —
12:13:14 AM: 1. /opt/build/repo/resources
12:13:14 AM: 2. /opt/build/repo/resources/_gen
12:13:14 AM: ​
12:13:14 AM: (netlify-plugin-hugo-cache-resources onPreBuild completed in 247ms)
12:13:14 AM: ​
12:13:14 AM: ────────────────────────────────────────────────────────────────
12:13:14 AM: 2. build.command from netlify.toml
12:13:14 AM: ────────────────────────────────────────────────────────────────
12:13:14 AM: ​
12:13:14 AM: $ hugo --gc --minify -b $URL
12:13:14 AM: Start building sites …
12:13:14 AM: hugo v0.84.4-020E4ACE+extended linux/amd64 BuildDate=2021-07-01T11:51:55Z VendorInfo=gohugoio
12:13:14 AM: Total in 175 ms
12:13:14 AM: Error: Error building site: “/opt/build/repo/content/publication/latner-evolutionary-2020/index.md:4:1”: failed to unmarshal YAML: yaml: line 3: mapping values are not allowed in this context
12:13:14 AM: ​
12:13:14 AM: ────────────────────────────────────────────────────────────────
12:13:14 AM: “build.command” failed
12:13:14 AM: ────────────────────────────────────────────────────────────────
12:13:14 AM: ​
12:13:14 AM: Error message
12:13:14 AM: Command failed with exit code 255: hugo --gc --minify -b $URL
12:13:14 AM: ​
12:13:14 AM: Error location
12:13:14 AM: In build.command from netlify.toml:
12:13:14 AM: hugo --gc --minify -b $URL
12:13:14 AM: ​
12:13:14 AM: Resolved config
12:13:14 AM: build:
12:13:14 AM: command: hugo --gc --minify -b $URL
12:13:14 AM: commandOrigin: config
12:13:14 AM: environment:
12:13:14 AM: - HUGO_VERSION
12:13:14 AM: - HUGO_ENABLEGITINFO
12:13:14 AM: - HUGO_ENV
12:13:14 AM: publish: /opt/build/repo/public
12:13:14 AM: publishOrigin: config
12:13:14 AM: plugins:
12:13:14 AM: - inputs:
12:13:14 AM: debug: true
12:13:14 AM: origin: config
12:13:14 AM: package: netlify-plugin-hugo-cache-resources
12:13:14 AM: Caching artifacts
12:13:14 AM: Started saving build plugins
12:13:14 AM: Finished saving build plugins
12:13:14 AM: Started saving pip cache
12:13:14 AM: Finished saving pip cache
12:13:14 AM: Started saving emacs cask dependencies
12:13:14 AM: Finished saving emacs cask dependencies
12:13:14 AM: Started saving maven dependencies
12:13:14 AM: Finished saving maven dependencies
12:13:14 AM: Started saving boot dependencies
12:13:15 AM: Finished saving boot dependencies
12:13:15 AM: Started saving rust rustup cache
12:13:15 AM: Finished saving rust rustup cache
12:13:15 AM: Started saving go dependencies
12:13:15 AM: Finished saving go dependencies
12:13:15 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:13:15 AM: Creating deploy upload records
12:13:15 AM: Failing build: Failed to build site
12:13:15 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
12:13:15 AM: Finished processing build request in 17.565168131s

Welcome to the forums @mlatner

Certainly not at my A-game with Hugo, but from your log, this is the main error.

As you said it built fine a few times but now fails, I wonder if you do a “Clear cache and deploy site” (available on the Deploys page)

Screen Shot 2021-07-26 at 8.58.58 am

Yes tried a few times, no luck.

Hi @mlatner,

It’s a pretty common issue with this theme specifically. It’s a problem with the Markdown formatting that you might be using. If you can share your Markdown file mentioned by the error, we can point out what can be going wrong.

Thank you! This is the md file that shows an error:

---
# Documentation: https://wowchemy.com/docs/managing-content/

title: ‪Evolutionary Psychology and Political Institutions‬, '‪The SAGE Handbook of Evolutionary Psychology: Applications of Evolutionary …,
  2020‬'
subtitle: ''
summary: ''
authors:
- Michael Latner
- Elissa Feld
tags: []
categories: []
date: '2020-01-01'
lastmod: 2021-07-23T13:12:18-07:00
featured: false
draft: false

# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
image:
  caption: ''
  focal_point: ''
  preview_only: false

# Projects (optional).
#   Associate this post with one or more of your projects.
#   Simply enter your project's folder or file name without extension.
#   E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
#   Otherwise, set `projects = []`.
projects: []
publishDate: '2021-07-23T20:12:18.489518Z'
publication_types:
- '0'
abstract: Biology and political science have a long, symbiotic relationship in their shared focus on conflict and cooperation between organisms. Many of the major puzzles in biology and political science, from the emergence of cooperation, and the threat of parasitism and selfishness, to the dynamics of collective decision making and the evolution of morality, are interwoven in early, pre-Darwinian works. As these areas of study developed into separate professional disciplines in the early 20th century, they would part ways with considerable tension before returning to such fundamentals with the advent of modern evolutionary psychology. In this chapter, we survey the literature surrounding three major areas where ...
publication: 'The SAGE Handbook of Evolutionary Psychology: Applications of Evolutionary …,'
url_pdf: https://scholar.google.com/citations?view_op=view_citation&hl=en&user=WESqQykAAAAJ&sortby=pubdate&citation_for_view=WESqQykAAAAJ:dhFuZR0502QC
---

The error Hugo throws tells you the problem is in line 4 of your file, which is the title line. I think you need to wrap your title in inverted commas:

title: "‪Evolutionary Psychology and Political Institutions‬, '‪The SAGE Handbook of Evolutionary Psychology: Applications of Evolutionary …,  2020‬'"

See syntax - YAML: Do I need quotes for strings in YAML? - Stack Overflow