# Netlify Build Error 255 (ToCSS) troubleshooting

**URL:** <https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887>\
**Category:** support\
**Created:** [May 28, 2020, 4:39pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887 "2020-05-28T16:39:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![angel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/angel/32/6325_2.png) [@angel](https://discourse.gohugo.io/u/angel)\
**Post date:** [May 28, 2020, 4:39pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/1 "2020-05-28T16:39:38Z")

</div>

Is your Hugo site not deploying on Netlify due to “Error 255”?

First make sure you’re using the new image build selection and try setting the HUGO\_VERSION to the one you’re using locally. [Info from Netlify docs](https://docs.netlify.com/configure-builds/common-configurations/#hugo). Generally this should work (see the many posts in this forum).

Still not working? It could be because Netlify isn’t using the Hugo Extended version.

However, if it’s not working and you’re getting errors that say “Command failed with exit code 255:” or “resource X not found in file cache” there’s a simple solution.

**Error you’re probably seeing (note how the log says hugo’s not found and it installs a non-extended version)**

```auto
4:35:55 PM: $ hugo --gc --minify --enableGitInfo --baseURL $URL --environment development
4:35:55 PM: DEBUG target={ platform: 'linux', arch: 'x64' }, hugo={ version: '0.71.0' }
4:35:55 PM: DEBUG searching executable at </opt/build/repo/node_modules/hugo-cli/tmp/hugo_0.71.0_linux_amd64>
4:35:55 PM: INFO hugo not found. Attempting to fetch it...
4:35:55 PM: DEBUG downloading archive from <https://github.com/gohugoio/hugo/releases/download/v0.71.0/hugo_0.71.0_Linux-64bit.tar.gz>
4:35:56 PM: INFO fetched hugo 0.71.0
4:35:56 PM: INFO extracting archive...
4:35:57 PM: DEBUG extracted archive to </opt/build/repo/node_modules/hugo-cli/tmp>
4:35:57 PM: INFO hugo available, let's go!
4:35:57 PM: Building sites …
4:37:57 PM: ERROR 2020/05/27 23:37:57 TOCSS: failed to transform "scss/main.scss" (text/x-scss): resource "scss/scss/main.scss_df0fcb6fcf7ac0465cc4f11d40f9fe96" not found in file cache
4:37:57 PM: Total in 120386 ms
4:37:57 PM: Error: Error building site: TOCSS: failed to transform "scss/main.scss" (text/x-scss): resource "scss/scss/main.scss_e59e0ecc24dedce3dd5dba3ad899859c" not found in file cache

```

**What’s happening**  
For some reason Netlify build isn’t using Hugo’s extended version which you need to use SCSS/ToCSS.

**How to fix**  
Add the `hugo-extended` package with `npm install hugo-extended --save-dev`

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [May 28, 2020, 5:31pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/2 "2020-05-28T17:31:55Z")

</div>

So, the error message isn’t very helpful, I take the blame for that.

But you nee the extended version for this, and reading

> **[Common configurations](https://docs.netlify.com/configure-builds/common-configurations/#hugo)**
>
> Netlify builds, deploys, and hosts your front end. 
> Learn how to get started, see examples, and view documentation for the modern web platform.

You probably have an older Netlify build image set up.

---

<div class="post-metadata">

**Author:** ![angel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/angel/32/6325_2.png) [@angel](https://discourse.gohugo.io/u/angel)\
**Post date:** [May 28, 2020, 5:48pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/3 "2020-05-28T17:48:10Z")

</div>

@bep Thank you for the suggestion. Don’t be so hard on yourself, the improved error messages, especially 0.50, have been a massive help for me. Thanks!

In this instance it was an issue despite the correct build image where Netlify was using the non-extended version.

I’ve clarified my post to try your/netlify’s recommend troubleshooting first.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [May 28, 2020, 7:14pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/4 "2020-05-28T19:14:35Z")

</div>

OK, but the only reason I know of why Netlify would use the non-extended version if you use an old build image, so I would double-and-triple check that. And if that fails, I would ask Netlify about it.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [May 28, 2020, 7:17pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/5 "2020-05-28T19:17:15Z")

</div>

OK, looking closer …

```auto
DEBUG searching executable at </Users/computer/Code/jbm-marketing-site/node_modules/hugo-cli/tmp/hugo_0.71.1_darwin_amd64>
INFO hugo not found. Attempting to fetch it...
DEBUG downloading archive from <https://github.com/gohugoio/hugo/releases/download/v0.71.1/hugo_0.71.1_macOS-64bit.tar.gz>
INFO fetched hugo 0.71.1

```

The above log confuses me. Is this you running the netlify dev tool locally? Re. the refs to Darwin/MacOS. I have no idea how that work in all of this, though …

---

<div class="post-metadata">

**Author:** ![angel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/angel/32/6325_2.png) [@angel](https://discourse.gohugo.io/u/angel)\
**Post date:** [May 29, 2020, 12:50am UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/6 "2020-05-29T00:50:09Z")

</div>

Reached out to Netlify first. They were the ones that pointed out that their build tool was using the non-extended version.

We confirmed that the right build image was being used:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/a/a7cf0825723f176c740e24193c1d3d3e6af1c4ef.png)

That was a log from my local debugging efforts. I’ve updated the excerpt with Netlify’s build log.

I appreciate your efforts, Netlify seemed confused as to why it was using hugo non-extended.

If you are really curious in seeing the full deploy logs. I tried to record mostly the same commit so I could rule out any changes made to the repo. I’m not worried since it’s working now. I wrote the post as I think the fix was adding the npm package and it took me forever to come up with it since everything out there says change the build image which defaults to the correct one.

1. [last successful deploy before issue commit - staging@a28617b](https://github.com/brennanangel/netlify-build-logs/blob/master/staging%40a28617b%20(2020-05-25T19:39:38.642Z))
2. failed deploy of the [exact commit same commit - staging@a28617b failing after the issue started](https://github.com/brennanangel/netlify-build-logs/blob/master/staging%40a28617b%20(2020-05-27T23:34:21.986Z)) - (no changes made to repo or netlify on my side but uses 0.71.0. Which makes no sense to me sense netlify.toml in that commit was for 0.71.1 as shown in the first build. Why wouldn’t it use what’s in netlify.toml??)
3. first failed deploy - [commit staging@dbc308a](https://github.com/Jaquish-Biomedical/jbm-marketing-site/commit/dbc308ab5226d3000af7a9d93b11ef4086897bc9)
4. working deploy of the [same commit staging@a28617b after a deploy cached the `hugo-extended` package was on netlify](https://github.com/brennanangel/netlify-build-logs/blob/master/staging%40a28617b%20(2020-05-28T19:54:37.594Z))

---

<div class="post-metadata">

**Author:** ![angel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/angel/32/6325_2.png) [@angel](https://discourse.gohugo.io/u/angel)\
**Post date:** [May 29, 2020, 12:55am UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/7 "2020-05-29T00:55:48Z")

</div>

Do you think it’s worth adding a proposal issue for an error message when Hugo extended is required but not present?

---

<div class="post-metadata">

**Author:** ![erezrokah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/erezrokah/32/11572_2.png) [@erezrokah](https://discourse.gohugo.io/u/erezrokah)\
**Post date:** [June 7, 2020, 4:56pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/8 "2020-06-07T16:56:23Z")

</div>

Sorry for the late follow up here but commented on the relevant issue under the Netlify organisation [https://github.com/netlify/build/issues/1392#issuecomment-640246741](https://github.com/netlify/build/issues/1392#issuecomment-640246741)

TLDR: looks like there is a 3rd party dependency called `hugo-cli` shadowing Netlify build Hugo binary. Netlify does download the extended version, but `hugo-cli` doesn’t.

Solution - remove that dependency or use one that downloads the extended like `hugo-extended`.

---

<div class="post-metadata">

**Author:** ![angel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/angel/32/6325_2.png) [@angel](https://discourse.gohugo.io/u/angel)\
**Post date:** [June 8, 2020, 10:57pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/9 "2020-06-08T22:57:27Z")

</div>

> Solution - remove `hugo-cli` dependency or use `hugo-extended`

Thank you Erezrokah!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [June 10, 2020, 10:57pm UTC](https://discourse.gohugo.io/t/netlify-build-error-255-tocss-troubleshooting/25887/10 "2020-06-10T22:57:28Z")

</div>

Closed on June 10, 2020, 10:57pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
