Hugo (0.153+) panics when building complex site

Hi everybody,

I’ve run into a strange issue with Hugo (version 0.153 and up) where it panics when building a fairly large site. I’m completely lost at where to start looking for a solution, since it only affects this particular project and doesn’t point to any part of the project itself. Even the error output is not consistent - I’ve included two examples - but hopefully somebody might know where to look, and what further details I can share to resolve the issue. Thanks in advance.

panic: interface conversion: hugolib.contentNodes is not hugolib.contentNodeSingle: missing method nodeCategorySingle

goroutine 1 [running]:
github.com/gohugoio/hugo/hugolib.(*contentNodeShifter).Delete(0x1055d4524?, {0x107430750?, 0x1400179a870}, {0x1, 0x0, 0x0})
	github.com/gohugoio/hugo/hugolib/content_map_page_contentnodeshifter.go:44 +0x154
github.com/gohugoio/hugo/hugolib/doctree.(*NodeShiftTree[...]).delete(0x107499200, {0x14001a4f7c0, 0x33})
	github.com/gohugoio/hugo/hugolib/doctree/nodeshifttree.go:165 +0x84
github.com/gohugoio/hugo/hugolib/doctree.(*NodeShiftTree[...]).DeletePrefix(0x107499200, {0x140011e9830, 0x29})
	github.com/gohugoio/hugo/hugolib/doctree/nodeshifttree.go:153 +0xd4
github.com/gohugoio/hugo/hugolib/doctree.MutableTrees.DeletePrefix(...)
	github.com/gohugoio/hugo/hugolib/doctree/support.go:179
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages.func1-range1(0x14000205400, {0x14004524900?, 0x14002b3b0a8?, 0x14002b3b038?})
	github.com/gohugoio/hugo/hugolib/content_map_page_assembler.go:107 +0x144
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages.func1.(*Map[...]).All.1()
	github.com/gohugoio/hugo/common/maps/map.go:124 +0xc4
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages.func1()
	github.com/gohugoio/hugo/hugolib/content_map_page_assembler.go:104 +0x5c
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages(0x14000802780)
	github.com/gohugoio/hugo/hugolib/content_map_page_assembler.go:143 +0x228
github.com/gohugoio/hugo/hugolib.(*HugoSites).assemble(0x14000504fc0, {0x107445b80, 0x109263aa0}, {0x107459030?, 0x14000621260?}, 0x140002fdb00)
	github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:344 +0x240
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func6(...)
	github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:176
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0x14000504fc0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, {0x0, ...})
	github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:186 +0x630
github.com/gohugoio/hugo/commands.(*hugoBuilder).buildSites(0x140000e4930?, 0x0)
	github.com/gohugoio/hugo/commands/hugobuilder.go:427 +0xbc
github.com/gohugoio/hugo/commands.(*hugoBuilder).fullBuild.func3(...)
	github.com/gohugoio/hugo/commands/hugobuilder.go:560
github.com/gohugoio/hugo/commands.(*hugoBuilder).fullBuild(0x14000927400, 0x0)
	github.com/gohugoio/hugo/commands/hugobuilder.go:576 +0x2b4
github.com/gohugoio/hugo/commands.(*hugoBuilder).build(0x14000927400)
	github.com/gohugoio/hugo/commands/hugobuilder.go:399 +0x58
github.com/gohugoio/hugo/commands.(*rootCommand).Run.func1(0x14000927400?, 0x1400002e540?)
	github.com/gohugoio/hugo/commands/commandeer.go:382 +0x70
github.com/gohugoio/hugo/commands.(*rootCommand).Run(0x1400073cb00, {0x0?, 0x0?}, 0x1400002e540, {0x0?, 0xcf3c753375dac4f0?, 0x140006e99b0?})
	github.com/gohugoio/hugo/commands/commandeer.go:387 +0xe4
github.com/bep/simplecobra.(*Commandeer).compile.func1(0x140006bd400?, {0x1400093ac20?, 0x4?, 0x106423688?})
	github.com/bep/simplecobra@v0.6.1/simplecobra.go:113 +0x50
github.com/spf13/cobra.(*Command).execute(0x140008fc308, {0x140000720b0, 0x1, 0x1})
	github.com/spf13/cobra@v1.10.2/command.go:1015 +0x7d4
github.com/spf13/cobra.(*Command).ExecuteC(0x140008fc308)
	github.com/spf13/cobra@v1.10.2/command.go:1148 +0x350
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
	github.com/spf13/cobra@v1.10.2/command.go:1080
github.com/bep/simplecobra.(*Exec).Execute(0x14000410d98, {0x107445b80?, 0x109263aa0?}, {0x140000720b0?, 0x140006e9f38?, 0x1043d5c18?})
	github.com/bep/simplecobra@v0.6.1/simplecobra.go:155 +0xa8
github.com/gohugoio/hugo/commands.Execute({0x140000720b0, 0x1, 0x1})
	github.com/gohugoio/hugo/commands/commandeer.go:68 +0x264
main.main()
	github.com/gohugoio/hugo/main.go:28 +0x68

panic: interface conversion: hugolib.contentNodes is not hugolib.contentNodeSingle: missing method nodeCategorySingle

goroutine 38 [running]:
github.com/gohugoio/hugo/hugolib.(*contentNodeShifter).Delete(0x101be8524?, {0x103a44750?, 0x140011d2ae0}, {0x1, 0x0, 0x0})
	github.com/gohugoio/hugo/hugolib/content_map_page_contentnodeshifter.go:44 +0x154
github.com/gohugoio/hugo/hugolib/doctree.(*NodeShiftTree[...]).delete(0x103aad200, {0x14001ba56c0, 0x33})
	github.com/gohugoio/hugo/hugolib/doctree/nodeshifttree.go:165 +0x84
github.com/gohugoio/hugo/hugolib/doctree.(*NodeShiftTree[...]).DeletePrefix(0x103aad200, {0x14001449260, 0x29})
	github.com/gohugoio/hugo/hugolib/doctree/nodeshifttree.go:153 +0xd4
github.com/gohugoio/hugo/hugolib/doctree.MutableTrees.DeletePrefix(...)
	github.com/gohugoio/hugo/hugolib/doctree/support.go:179
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages.func1-range1(0x1400097ad00, {0x14002940400?, 0x140037637f8?, 0x14003763788?})
	github.com/gohugoio/hugo/hugolib/content_map_page_assembler.go:107 +0x144
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages.func1.(*Map[...]).All.1()
	github.com/gohugoio/hugo/common/maps/map.go:124 +0xc4
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages.func1()
	github.com/gohugoio/hugo/hugolib/content_map_page_assembler.go:104 +0x5c
github.com/gohugoio/hugo/hugolib.(*allPagesAssembler).createAllPages(0x14000798140)
	github.com/gohugoio/hugo/hugolib/content_map_page_assembler.go:143 +0x228
github.com/gohugoio/hugo/hugolib.(*HugoSites).assemble(0x14000512e00, {0x103a59b80, 0x105877aa0}, {0x103a6d030?, 0x140001b3560?}, 0x14000e93380)
	github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:344 +0x240
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func6(...)
	github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:176
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0x14000512e00, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, {0x0, ...})
	github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:186 +0x630
github.com/gohugoio/hugo/commands.(*hugoBuilder).buildSites(0x0?, 0x0)
	github.com/gohugoio/hugo/commands/hugobuilder.go:427 +0xbc
github.com/gohugoio/hugo/commands.(*hugoBuilder).fullBuild.func3()
	github.com/gohugoio/hugo/commands/hugobuilder.go:560 +0x24
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.19.0/errgroup/errgroup.go:93 +0x4c
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
	golang.org/x/sync@v0.19.0/errgroup/errgroup.go:78 +0x90

So, it’s a bug. I can see the “where it fails”, which should be enough to fix the issue, I guess…

There will be a new Hugo version out tomorrow (I think); I will try to get a fix for this by then.

2 Likes

0.155.0 did resolve the issue. Thank you so much! :smiling_face_with_three_hearts:

1 Like

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