Dart Sass timeout on Windows

When running a Hugo 0.157.0 build, it halts for about 30 seconds then ends with this error:

TOCSS-DART: failed to transform “/css/website.scss” (text/x-scss): “:1:1”: timeout waiting for Dart Sass to respond; note that this project is only compatible with the Dart Sass Binary found here: Releases · sass/dart-sass · GitHub

I did install the Dart Sass binary from that url indicated, and installed into a directory outside of my project and in my PATH. From hugo env it appears Hugo can find it:

hugo v0.157.0-7747abbb316b03c8f353fd3be62d5011fa883ee6+extended windows/amd64 BuildDate=2026-02-25T16:38:33Z VendorInfo=gohugoio
GOOS=“windows”
GOARCH=“amd64”
GOVERSION=“go1.26.0”
github.com/webmproject/libwebp=“v1.6.0”
github.com/sass/libsass=“3.6.6”
github.com/sass/dart-sass/protocol=“3.2.0”
github.com/sass/dart-sass/compiler=“1.97.3”
github.com/sass/dart-sass/implementation=“1.97.3”

Note that the .zip file downloaded from the URL given above has sass.bat in the PATH folder and a ./src/dart.exe in a “src” subfolder. That’s how I have it in my PATH folder and it seems to get invoked, just that it times out. Any ideas? I’m stumped so far.

UPDATE #1: I decided to simplify the problem by simplifying my SCSS. I reduced it right down to just a pure CSS reset … and it worked! I slowly added my @use back in and finally found that it failed with timeout when calling an @function that I had defined. I added some SCSS syntax errors and they failed immediately with an informative message. Something about calling an @function causes Sass to hang. I’ll add more if I find anything (in case anyone else runs into this).

UPDATE #2: Silly me. My @function had an infinite loop. It all worked before when I was using standalone Sass as a separate pre-Hugo build step (as I’ve done since before Hugo supported Sass). I made a small tweak (bug, actually) to my @function just before I started working on having Hugo call Sass for me (eliminating the pre-build step). D-oh! For the curious, a loop in Sass is required because Sass doesn’t have a string.replace($svg, “#”, “%23”) function; you have to loop to do it yourself.

1 Like