Getting panic runtime error after upgrade to 0.123.4

I just upgraded my local Hugo build to v0.123.4+extended via Homebrew from v0.119.x (also extended). Here’s my full hugo env output:

hugo v0.123.4-21a41003c4633b142ac565c52da22924dc30637a+extended darwin/arm64 BuildDate=2024-02-26T16:33:05Z VendorInfo=brew
GOOS="darwin"
GOARCH="arm64"
GOVERSION="go1.22.0"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"
github.com/sass/dart-sass/protocol="2.4.0"
github.com/sass/dart-sass/compiler="1.70.0"
github.com/sass/dart-sass/implementation="1.70.0"

However after upgrading, I encountered the following panic crash:

INFO  Translation func for language da not found, use default.
INFO  Translation func for language sv not found, use default.
Watching for changes in /Users/username/Sites/my-site/{archetypes,assets,babel.config.js,content,data,hugo_stats.json,i18n,layouts,package.json,postcss.config.js,static,tailwind.config.js}
Watching for config changes in /Users/username/Sites/my-site/config/_default, /Users/username/Sites/my-site/config/_default/menus
Start building sites …
hugo v0.123.4-21a41003c4633b142ac565c52da22924dc30637a+extended darwin/arm64 BuildDate=2024-02-26T16:33:05Z VendorInfo=brew

INFO  build:  step process substep collect files 4502 files_total 4502 duration 123.363ms
INFO  build:  step process duration 123.41425ms
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104db7d28]

goroutine 61 [running]:
github.com/gohugoio/hugo/source.(*File).p(...)
	github.com/gohugoio/hugo/source/fileInfo.go:133
github.com/gohugoio/hugo/source.(*File).TranslationBaseName(0x107a0c9c0?)
	github.com/gohugoio/hugo/source/fileInfo.go:82 +0x18
github.com/gohugoio/hugo/hugolib.(*pageState).setMetaPostParams(0x14006214a10)
	github.com/gohugoio/hugo/hugolib/page__meta.go:526 +0x1164
github.com/gohugoio/hugo/hugolib.(*pageState).setMetaPost(0x14006214a10, 0x107ba7040?)
	github.com/gohugoio/hugo/hugolib/page__meta.go:385 +0x524
github.com/gohugoio/hugo/hugolib.(*sitePagesAssembler).applyAggregates.func1({0x14005238660, 0x14}, {0x107ba3930, 0x14006214a10}, 0x10?)
	github.com/gohugoio/hugo/hugolib/content_map_page.go:1298 +0x3a4
github.com/gohugoio/hugo/hugolib/doctree.(*NodeShiftTreeWalker[...]).Walk.func1({0x107b670a0, 0x14006214a10})
	github.com/gohugoio/hugo/hugolib/doctree/nodeshifttree.go:358 +0x108
github.com/armon/go-radix.recursiveWalk(0x14005ff1e60, 0x14001bfddd0)
	github.com/armon/go-radix@v1.0.1-0.20221118154546-54df44f2176c/radix.go:523 +0x48
github.com/armon/go-radix.recursiveWalk(0x14002280d50, 0x14001bfddd0)
	github.com/armon/go-radix@v1.0.1-0.20221118154546-54df44f2176c/radix.go:532 +0xa4
github.com/armon/go-radix.recursiveWalk(0x140003d1bf0, 0x14001bfddd0)
	github.com/armon/go-radix@v1.0.1-0.20221118154546-54df44f2176c/radix.go:532 +0xa4
github.com/armon/go-radix.(*Tree).Walk(...)
	github.com/armon/go-radix@v1.0.1-0.20221118154546-54df44f2176c/radix.go:453
github.com/gohugoio/hugo/hugolib/doctree.(*NodeShiftTreeWalker[...]).Walk(0x107bab300?, {0x0?, 0x0?})
	github.com/gohugoio/hugo/hugolib/doctree/nodeshifttree.go:368 +0x100
github.com/gohugoio/hugo/hugolib.(*sitePagesAssembler).applyAggregates(0x14005ff0cc0)
	github.com/gohugoio/hugo/hugolib/content_map_page.go:1375 +0x204
github.com/gohugoio/hugo/hugolib.(*sitePagesAssembler).assemblePagesStep1(0x14005ff0cc0, {0x0?, 0x0?})
	github.com/gohugoio/hugo/hugolib/content_map_page.go:1668 +0x44
github.com/gohugoio/hugo/hugolib.(*HugoSites).assemble.func1()
	github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:269 +0x28
github.com/gohugoio/hugo/common/para.(*errGroupRunner).Run.func1()
	github.com/gohugoio/hugo/common/para/para.go:52 +0x2c
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.6.0/errgroup/errgroup.go:78 +0x58
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 14
	golang.org/x/sync@v0.6.0/errgroup/errgroup.go:75 +0x98
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I latched on to the TranslationBaseName mention, and tried to remove all instances, but that did nothing.

Anyone able to point me in the right direction for debugging? Unfortunately I have a private repo, so I can’t share, but am happy to answer as many questions as are necessary.

Can you share it privately via DM?

I’d have to work with my company’s IT/security team to grant access to the repo. Can start that process in the morning.

Meantime, do you have any hunches that I could use to start hunting down the bug?

Nope.

Through process of elimination, I’ve narrowed it down to these two config blocks:

# Disable taxonomy & term pages by default for languages which
# don't have content with taxonomies associated.
[[cascade]]
  render = false
  headless = true
  [cascade._build]
    list = false
    render = false
  [cascade._target]
    lang = "{da,it,sv,fil,hi,id,nl,pl,ru,vi}"
    kind = "{taxonomy,term}"

# The _content-components folder is never meant to be rendered,
# therefore it is marked as both headless and not to render
[[cascade]]
  headless = true
  render = false
  [cascade._build]
    render = "never"
  [cascade._target]
    path = "/_content-components**"

Good find.

[[cascade]]
  headless = true
  render = false
  [cascade._build]
    render = "never"
  [cascade._target]
    path = "/_content-components**"

1) In the above, render = false does nothing; it only does something when it’s a member of the _build map.

2) In the above, if you want to, you can specify build instead of _build. That’s new in v0.123.0.

3) Specifying headless = true and build options is superfluous. Use one or the other; not both. And the “headless = true” bit is what is triggering the panic.

In summary, change the TOML above to:

[[cascade]]
  [cascade.build]
    render = "never"
  [cascade._target]
    path = "/_content-components**"

See https://github.com/gohugoio/hugo/issues/12172.

2 Likes

This was fixed in v0.123.6.

2 Likes

Thank you!

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