Hugo site, build successfully in local, but failed on Netlify

Hi I’m new to both Netlify and Hugo.
I’m trying to build web site made with Hugo, but got a following error.
The site was build successfully on my local environment, but failed on Netlify.
I set the same HUGO_VERSION as my local’s, which is “v0.76.5”.
Specifically I use hugo version of “v0.76.5/extended” on my local but I chose “Ubuntu Xenial 16.04 (default)” and so it’s not the cause of the error, I think.

12:41:29 PM: Starting build script

12:41:29 PM: Installing dependencies

12:41:29 PM: Python version set to 2.7

12:41:31 PM: v12.18.0 is already installed.

12:41:32 PM: Now using node v12.18.0 (npm v6.14.4)

12:41:32 PM: Started restoring cached build plugins

12:41:32 PM: Finished restoring cached build plugins

12:41:32 PM: Attempting ruby version 2.7.1, read from environment

12:41:34 PM: Using ruby version 2.7.1

12:41:34 PM: Using PHP version 5.6

12:41:34 PM: 5.2 is already installed.

12:41:34 PM: Using Swift version 5.2

12:41:34 PM: Installing Hugo 0.76.5

12:41:35 PM: Hugo Static Site Generator v0.76.5-60F0725B/extended linux/amd64 BuildDate: 2020-10-14T15:25:14Z

12:41:36 PM: Started restoring cached go cache

12:41:36 PM: Finished restoring cached go cache

12:41:36 PM: go version go1.14.4 linux/amd64

12:41:36 PM: go version go1.14.4 linux/amd64

12:41:36 PM: Installing missing commands

12:41:36 PM: Verify run directory

12:41:37 PM: ​

12:41:37 PM: ┌─────────────────────────────┐

12:41:37 PM: │ Netlify Build │

12:41:37 PM: └─────────────────────────────┘

12:41:37 PM: ​

12:41:37 PM: ❯ Version

12:41:37 PM: @netlify/build 5.0.2

12:41:37 PM: ​

12:41:37 PM: ❯ Flags

12:41:37 PM: deployId: 5f94f3e385b289492ce5203e

12:41:37 PM: mode: buildbot

12:41:37 PM: ​

12:41:37 PM: ❯ Current directory

12:41:37 PM: /opt/build/repo

12:41:37 PM: ​

12:41:37 PM: ❯ Config file

12:41:37 PM: No config file was defined: using default values.

12:41:37 PM: ​

12:41:37 PM: ❯ Context

12:41:37 PM: production

12:41:37 PM: ​

12:41:37 PM: ┌───────────────────────────────────┐

12:41:37 PM: │ 1. Build command from Netlify app │

12:41:37 PM: └───────────────────────────────────┘

12:41:37 PM: ​

12:41:37 PM: $ hugo

12:41:37 PM: Start building sites …

12:41:37 PM: ERROR 2020/10/25 03:41:37 render of "page" failed: execute of template failed: template: _default/single.html:3:4: executing "_default/single.html" at <partial "head.html" .>: error calling partial: execute of template failed: template: partials/head.html:20:4: executing "partials/head.html" at <partial "style.html" .>: error calling partial: execute of template failed: template: partials/style.html:72:9: executing "partials/style.html" at <partial "custom-css.html" .>: error calling partial: "/opt/build/repo/themes/hugo-notepadium/layouts/partials/custom-css.html:5:42": execute of template failed: template: partials/custom-css.html:5:42: executing "partials/custom-css.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type <nil> not supported in Resource transformations

12:41:37 PM: ERROR 2020/10/25 03:41:37 render of "taxonomy" failed: execute of template failed: template: _default/list.html:3:4: executing "_default/list.html" at <partial "head.html" .>: error calling partial: execute of template failed: template: partials/head.html:20:4: executing "partials/head.html" at <partial "style.html" .>: error calling partial: execute of template failed: template: partials/style.html:72:9: executing "partials/style.html" at <partial "custom-css.html" .>: error calling partial: "/opt/build/repo/themes/hugo-notepadium/layouts/partials/custom-css.html:5:42": execute of template failed: template: partials/custom-css.html:5:42: executing "partials/custom-css.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type <nil> not supported in Resource transformations

12:41:37 PM: ERROR 2020/10/25 03:41:37 render of "home" failed: execute of template failed: template: index.html:3:4: executing "index.html" at <partial "head.html" .>: error calling partial: execute of template failed: template: partials/head.html:20:4: executing "partials/head.html" at <partial "style.html" .>: error calling partial: execute of template failed: template: partials/style.html:72:9: executing "partials/style.html" at <partial "custom-css.html" .>: error calling partial: "/opt/build/repo/themes/hugo-notepadium/layouts/partials/custom-css.html:5:42": execute of template failed: template: partials/custom-css.html:5:42: executing "partials/custom-css.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type <nil> not supported in Resource transformations

12:41:37 PM: ERROR 2020/10/25 03:41:37 render of "taxonomy" failed: execute of template failed: template: _default/list.html:3:4: executing "_default/list.html" at <partial "head.html" .>: error calling partial: execute of template failed: template: partials/head.html:20:4: executing "partials/head.html" at <partial "style.html" .>: error calling partial: execute of template failed: template: partials/style.html:72:9: executing "partials/style.html" at <partial "custom-css.html" .>: error calling partial: "/opt/build/repo/themes/hugo-notepadium/layouts/partials/custom-css.html:5:42": execute of template failed: template: partials/custom-css.html:5:42: executing "partials/custom-css.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type <nil> not supported in Resource transformations

12:41:37 PM: Total in 141 ms

12:41:37 PM: Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: _default/single.html:3:4: executing "_default/single.html" at <partial "head.html" .>: error calling partial: execute of template failed: template: partials/head.html:20:4: executing "partials/head.html" at <partial "style.html" .>: error calling partial: execute of template failed: template: partials/style.html:72:9: executing "partials/style.html" at <partial "custom-css.html" .>: error calling partial: "/opt/build/repo/themes/hugo-notepadium/layouts/partials/custom-css.html:5:42": execute of template failed: template: partials/custom-css.html:5:42: executing "partials/custom-css.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type <nil> not supported in Resource transformations

12:41:37 PM: ​

12:41:37 PM: ┌─────────────────────────────┐

12:41:37 PM: │ "build.command" failed │

12:41:37 PM: └─────────────────────────────┘

12:41:37 PM: ​

12:41:37 PM: Error message

12:41:37 PM: Command failed with exit code 255: hugo

12:41:37 PM: ​

12:41:37 PM: Error location

12:41:37 PM: In Build command from Netlify app:

12:41:37 PM: hugo

12:41:37 PM: ​

12:41:37 PM: Resolved config

12:41:37 PM: build:

12:41:37 PM: command: hugo

12:41:37 PM: commandOrigin: ui

12:41:37 PM: environment:

12:41:37 PM: - HUGO_VERSION

12:41:37 PM: publish: /opt/build/repo/public

12:41:37 PM: Caching artifacts

12:41:37 PM: Started saving build plugins

12:41:37 PM: Finished saving build plugins

12:41:37 PM: Started saving pip cache

12:41:38 PM: Finished saving pip cache

12:41:38 PM: Started saving emacs cask dependencies

12:41:38 PM: Finished saving emacs cask dependencies

12:41:38 PM: Started saving maven dependencies

12:41:38 PM: Finished saving maven dependencies

12:41:38 PM: Started saving boot dependencies

12:41:38 PM: Finished saving boot dependencies

12:41:38 PM: Started saving go dependencies

12:41:38 PM: Finished saving go dependencies

12:41:41 PM: Build failed due to a user error: Build script returned non-zero exit code: 2

12:41:41 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2

12:41:41 PM: Failing build: Failed to build site

12:41:41 PM: Finished processing build request in 16.587296963s

I use following theme.

Do you have any idea to solve this problem?

Do you have a link to your repository or is it unchanged from the theme? From the build log it says that there are errors in your file, but, you say, it builds fine locally. So, we’d need to check what’s wrong. You’re using some resource transformations that’s all I can see, but, any further debugging might not be possible without the source code.