Unable to import SCSS by relative path when using v0.123.0

Edited, after reading the release note, but didn’t find relative changes. Any clue about how to debug/solve this? Thanks.

hugo: downloading modules …
hugo: collected modules in 38532 ms
Start building sites … 
hugo v0.123.0-3c8a4713908e48e6523f058ca126710397aa4ed5+extended linux/amd64 BuildDate=2024-02-19T16:32:38Z VendorInfo=gohugoio

WARN  [seo] the assets/images/logo.png does not exist.
WARN  [archives] section archives/2024 not found
WARN  [archives] section archives/2024/02 not found
WARN  [archives] section archives/2024/01 not found
WARN  [abbr] missing title for "hugo"
WARN  [abbr] missing title for "foobar"
WARN  [file-content] no such file: static/invalid.txt
WARN  [archives] section archives/0001 not found
WARN  [archives] section archives/0001/01 not found
Total in 44367 ms
Error: error building site: TOCSS: failed to transform "hb/scss/index.scss" (text/x-scss): "/tmp/hugo_cache_runner/modules/filecache/modules/pkg/mod/github.com/hbstack/hb@v0.11.0/assets/hb/scss/index.tmpl.scss:117:1": File to import not found or unreadable: /../modules/custom/scss/index.scss.
Error: Process completed with exit code 1.

Full workflow log: chore(deps): update module github.com/hugomods/icons/vendors/lucide t… · hugomods/site@7463751 · GitHub

When I try to run locally, I got goroutine error (too long, I couldn’t capture all since it was cut off by terminal).

Summary
runtime.mallocgc(0x1770, 0x0, 0x0)
        /usr/local/go/src/runtime/malloc.go:1308 +0x814 fp=0xc0168be200 sp=0xc0168be178 pc=0x293594
runtime.slicebytetostring(0xce43525110?, 0xcd28504800, 0x1770)
        /usr/local/go/src/runtime/string.go:112 +0x77 fp=0xc0168be230 sp=0xc0168be200 pc=0x2dc2d7
fmt.Sprintf({0x2a93175, 0x6}, {0xc0168be2b8, 0x2, 0x2})
        /usr/local/go/src/fmt/print.go:240 +0x66 fp=0xc0168be288 sp=0xc0168be230 pc=0x398806
github.com/gohugoio/hugo/common/herrors.(*fileError).Error(0xcb006a7720)
        /root/project/hugo/common/herrors/file_error.go:145 +0x97 fp=0xc0168be2f0 sp=0xc0168be288 pc=0x7c5a37
fmt.(*pp).handleMethods(0xce43525040, 0xa7d39a?)
        /usr/local/go/src/fmt/print.go:667 +0x3e3 fp=0xc0168be4b0 sp=0xc0168be2f0 pc=0x39b3c3
fmt.(*pp).printArg(0xce43525040, {0x2920fe0, 0xcb006a7720}, 0x77)
        /usr/local/go/src/fmt/print.go:756 +0x446 fp=0xc0168be548 sp=0xc0168be4b0 pc=0x39bc06
fmt.(*pp).doPrintf(0xce43525040, {0xce49629680, 0xbc}, {0xc0168be900, 0x2, 0x2})
        /usr/local/go/src/fmt/print.go:1075 +0x37e fp=0xc0168be630 sp=0xc0168be548 pc=0x39e71e
fmt.Errorf({0xce49629680, 0xbc}, {0xc0168be900, 0x2, 0x2})
        /usr/local/go/src/fmt/errors.go:25 +0x85 fp=0xc0168be6f8 sp=0xc0168be630 pc=0x3958c5
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).errorf(0xc0168bfbf0, {0x2ae6d9f, 0x14}, {0xc0168be900, 0x2, 0x2})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:146 +0x216 fp=0xc0168be800 sp=0xc0168be6f8 pc=0x11985b6
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCall(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x0?}, {0x275f5e0?, 0xc000492c10?, 0x0?}, 0x0, {0x4286108, 0xc0011821e0}, ...)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:358 +0xc5f fp=0xc0168be990 sp=0xc0168be800 pc=0x11a62df
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalFunction(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x2?}, 0x2?, {0x4286108, 0xc0011821e0}, {0xc000fee480, 0x3, 0x4}, ...)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:145 +0x475 fp=0xc0168beae8 sp=0xc0168be990 pc=0x11a4575
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCommand(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x3?}, 0xc0011821e0, {0x274c380?, 0x55c4a00?, 0x4?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:511 +0x1d4 fp=0xc0168bebe0 sp=0xc0168beae8 pc=0x119aeb4
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalPipeline(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x2976383c9d8?}, 0xc000d66ea0)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:480 +0x125 fp=0xc0168bece0 sp=0xc0168bebe0 pc=0x119a825
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalArg(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0xc0168bee50?}, {0x429c9f0, 0x26d9740}, {0x4285fa0, 0xc000d66ea0})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:883 +0x346 fp=0xc0168bee00 sp=0xc0168bece0 pc=0x119c746
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCall(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0xcc17f4?}, {0x26e2240?, 0xc000463d40?, 0x119b9e5?}, 0x0, {0x4286108, 0xc001182180}, ...)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:328 +0x858 fp=0xc0168bef90 sp=0xc0168bee00 pc=0x11a5ed8
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalFunction(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x1?}, 0x1?, {0x4286108, 0xc001182180}, {0xc0013e79a0, 0x2, 0x2}, ...)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:147 +0x36e fp=0xc0168bf0e8 sp=0xc0168bef90 pc=0x11a446e
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCommand(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x26244e0?}, 0xc001182180, {0x26244e0?, 0xc0168934b8?, 0xc0013e7920?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:511 +0x1d4 fp=0xc0168bf1e0 sp=0xc0168bf0e8 pc=0x119aeb4
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalPipeline(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0xc0005a8bd0?}, 0xc000d66e40)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:480 +0x125 fp=0xc0168bf2e0 sp=0xc0168bf1e0 pc=0x119a825
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0xc0168bf3b0?}, {0x4285f58?, 0xc001182240})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:268 +0x14f fp=0xc0168bf378 sp=0xc0168bf2e0 pc=0x119936f
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x1?}, {0x4285df0?, 0xc001099ec0?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:281 +0x2db fp=0xc0168bf410 sp=0xc0168bf378 pc=0x11994fb
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkIfOrWith(0xc0168bfbf0, 0xa, {0x2a7a800?, 0xc0005a8bd0?, 0x90?}, 0x119a825?, 0xc001099ec0, 0x0)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:311 +0x137 fp=0xc0168bf4a8 sp=0xc0168bf410 pc=0x1199717
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0xc0168bf578?}, {0x4285fe8?, 0xc000fee740?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:278 +0x125 fp=0xc0168bf540 sp=0xc0168bf4a8 pc=0x1199345
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x2a7a800?, 0xc0005a8bd0?, 0x2a7a800?}, {0x4285df0?, 0xc001099dd0?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:281 +0x2db fp=0xc0168bf5d8 sp=0xc0168bf540 pc=0x11994fb
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkIfOrWith(0xc0168bfbf0, 0x13, {0x2a570a0?, 0xc01627b3c0?, 0xc000d66cc0?}, 0x429c9f0?, 0xc001099dd0, 0x0)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:309 +0x10a fp=0xc0168bf670 sp=0xc0168bf5d8 pc=0x11996ea
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x2a570a0?, 0xc01627b3c0?, 0xc000d67080?}, {0x4286030?, 0xc000fee7c0?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:292 +0x1e7 fp=0xc0168bf708 sp=0xc0168bf670 pc=0x1199407
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x2a570a0?, 0xc01627b3c0?, 0x0?}, {0x4285df0?, 0xc001182660?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:281 +0x2db fp=0xc0168bf7a0 sp=0xc0168bf708 pc=0x11994fb
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkRange.func2({0x2652740?, 0x22d2a80?, 0xc00c7ace80?}, {0x2a570a0?, 0xc01627b3c0?, 0xc0168bf8c0?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:396 +0x2c7 fp=0xc0168bf858 sp=0xc0168bf7a0 pc=0x119a287
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkRange(0xc0168bfbf0, {0x27073a0?, 0xc00c7ace80?, 0xc012229a18?}, 0xc000feed80)
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:404 +0x647 fp=0xc0168bf9d0 sp=0xc0168bf858 pc=0x1199e87
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x27073a0?, 0xc00c7ace80?, 0xc012229ad8?}, {0x4286078?, 0xc000feed80?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:284 +0xcd fp=0xc0168bfa68 sp=0xc0168bf9d0 pc=0x11992ed
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0168bfbf0, {0x27073a0?, 0xc00c7ace80?, 0x2976383c9d8?}, {0x4285df0?, 0xc0011823f0?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/exec.go:281 +0x2db fp=0xc0168bfb00 sp=0xc0168bfa68 pc=0x11994fb
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*Template).executeWithState(0x100000000?, 0xc012229bf0, {0x27073a0?, 0xc00c7ace80?, 0xc0009d2780?})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:103 +0x127 fp=0xc0168bfb98 sp=0xc0168bfb00 pc=0x11a4007
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*executer).ExecuteWithContext(0xc000282510, {0x427f980, 0xc008844d20}, {0x297636dd0a8, 0xc0009d2780}, {0x42629c0, 0x55c4a00}, {0x27073a0, 0xc00c7ace80})
        /root/project/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:90 +0x2f9 fp=0xc0168bfc78 sp=0xc0168bfb98 pc=0x11a3e19
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).ExecuteWithContext(0xc001236a80, {0x427f980, 0xc008844d20}, {0x4270e00, 0xc0009d2780}, {0x42629c0, 0x55c4a00}, {0x27073a0, 0xc00c7ace80})
        /root/project/hugo/tpl/tplimpl/template.go:261 +0x64a fp=0xc0168bfde0 sp=0xc0168bfc78 pc=0x1553e4a
github.com/gohugoio/hugo/tpl/partials.(*Namespace).include(0xc000492bf0, {0x427f980, 0xc008844d20}, {0xc000a7d3a3, 0x1e}, {0xc01627b380?, 0x0?, 0x0?})
        /root/project/hugo/tpl/partials/partials.go:201 +0x406 fp=0xc0168bff08 sp=0xc0168bfde0 pc=0x15254c6
github.com/gohugoio/hugo/tpl/partials.(*Namespace).includWithTimeout.func1()
        /root/project/hugo/tpl/partials/partials.go:137 +0x48 fp=0xc0168bffe0 sp=0xc0168bff08 pc=0x1525028
runtime.goexit({})
        /usr/local/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0168bffe8 sp=0xc0168bffe0 pc=0x2fa261
created by github.com/gohugoio/hugo/tpl/partials.(*Namespace).includWithTimeout in goroutine 24908
        /root/project/hugo/tpl/partials/partials.go:136 +0x1bf

goroutine 4609700 gp=0xc016876000 m=nil [runnable]:
context.WithDeadlineCause.func2()
        /usr/local/go/src/context/context.go:638 fp=0xc0168bbfe0 sp=0xc0168bbfd8 pc=0x3a9680
runtime.goexit({})
        /usr/local/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0168bbfe8 sp=0xc0168bbfe0 pc=0x2fa261
created by time.goFunc
        /usr/local/go/src/time/sleep.go:177 +0x2d

goroutine 2572983 gp=0xc0165ba700 m=nil [runnable]:
context.WithDeadlineCause.func2()
        /usr/local/go/src/context/context.go:638 fp=0xc016987fe0 sp=0xc016987fd8 pc=0x3a9680
runtime.goexit({})
        /usr/local/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc016987fe8 sp=0xc016987fe0 pc=0x2fa261
created by time.goFunc
        /usr/local/go/src/time/sleep.go:177 +0x2d

goroutine 4603776 gp=0xc0168761c0 m=nil [runnable]:
context.WithDeadlineCause.func2()
        /usr/local/go/src/context/context.go:638 fp=0xc016983fe0 sp=0xc016983fd8 pc=0x3a9680
runtime.goexit({})
        /usr/local/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc016983fe8 sp=0xc016983fe0 pc=0x2fa261
created by time.goFunc
        /usr/local/go/src/time/sleep.go:177 +0x2d

goroutine 4136799 gp=0xc016894fc0 m=nil [runnable]:
context.WithDeadlineCause.func2()
        /usr/local/go/src/context/context.go:638 fp=0xc0168c9fe0 sp=0xc0168c9fd8 pc=0x3a9680
runtime.goexit({})
        /usr/local/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0168c9fe8 sp=0xc0168c9fe0 pc=0x2fa261
created by time.goFunc
        /usr/local/go/src/time/sleep.go:177 +0x2d
...

Reproduce steps:

git clone https://github.com/hugomods/site
cd site/main
npm ci
hugo

I opened top in another terminal, then built with v0.123.0. The first line, hugo, consumed exactly 75% of memory before my system froze. All of my system memory was consumed, and all of my swap space.

1 Like

Tested again with hugo v0.123.0-eceeb197. No change.

@razon Given the run-away memory consumption, you should ultimately create a GitHub issue for this. However, this test site is very complex, and will probably take us a long time to zero-in on the problem. To be frank, it’s so complex that I don’t want to spend any time on it.

Can you start tearing things out (bisection), to see if you can come up with minimal test case?

1 Like

No problem, I’m working on it.

The root cause of the SASS importing is that now Resource.Name returns a absolute path (with a leading slash) instead of relative path. Remove the leading slash work.

{{- range resources.Match "hb/modules/*/scss/index.scss" }}
@import "{{ replace .Name "hb/modules" "../modules" | strings.TrimPrefix `/` }}";
{{- end }}

After debuging by disabling templates one by one, there is a infinite loop in tempalte cause built failed.

@jmooring, sorry to bother you and thank you spending time on this.

No problem! I’m glad everything’s working.

To confirm, this example is no longer correct?
https://gohugo.io/methods/resource/name/#global-resource

Yes, there will be a leading slash of .Name.

Screenshot_2024-02-21_14-50-37

I’ve updated the documentation.
https://gohugo.io/methods/resource/name/

1 Like

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