Skip to content

panic with nonsensical return construct #13600

Closed
@MarlonLuan

Description

@MarlonLuan

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.146.3-05ef8b713a3c091bfca7a3543ed016c64b3c6f88+extended linux/amd64 BuildDate=2025-04-12T17:21:50Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes
In 0.144.2 its work

In 0.145.x, it doesn't work.
In 0.146.x, it doesn't work.

git clone https://github.com/MarlonLuan/hugo-0.145.x
cd hugo-0.145.x
hugo
{{ return ( delimit . ", " ) | string }}
Start building sites … 
hugo v0.146.3-05ef8b713a3c091bfca7a3543ed016c64b3c6f88+extended linux/amd64 BuildDate=2025-04-12T17:21:50Z VendorInfo=gohugoio

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x14ff5b9]

goroutine 15 [running]:
github.com/gohugoio/hugo/tpl/tplimpl.(*templateTransformContext).applyTransformations(0xc0000338b0, {0x2573518?, 0x0})
        /root/project/hugo/tpl/tplimpl/templatetransform.go:181 +0x4f9
github.com/gohugoio/hugo/tpl/tplimpl.(*templateTransformContext).applyTransformations(0xc0000338b0, {0x2573320?, 0xc0000bfda0})
        /root/project/hugo/tpl/tplimpl/templatetransform.go:171 +0x63a
github.com/gohugoio/hugo/tpl/tplimpl.(*templateTransformContext).applyTransformationsToNodes(...)
        /root/project/hugo/tpl/tplimpl/templatetransform.go:252
github.com/gohugoio/hugo/tpl/tplimpl.(*templateTransformContext).applyTransformations(0xc0000338b0, {0x25733b0?, 0xc0005e7d70})
        /root/project/hugo/tpl/tplimpl/templatetransform.go:155 +0x939
github.com/gohugoio/hugo/tpl/tplimpl.(*templateTransformContext).applyTransformationsToNodes(...)
        /root/project/hugo/tpl/tplimpl/templatetransform.go:252
github.com/gohugoio/hugo/tpl/tplimpl.(*templateTransformContext).applyTransformations(0xc0000338b0, {0x25731b8?, 0xc0005e7c20})
        /root/project/hugo/tpl/tplimpl/templatetransform.go:152 +0x5d4
github.com/gohugoio/hugo/tpl/tplimpl.applyTemplateTransformers(0xc0005ac8c0, 0x237ea90)
        /root/project/hugo/tpl/tplimpl/templatetransform.go:82 +0x152
github.com/gohugoio/hugo/tpl/tplimpl.(*TemplateStore).transformTemplates-range1(0xc0005ac8c0)
        /root/project/hugo/tpl/tplimpl/templatestore.go:1706 +0xa5
github.com/gohugoio/hugo/tpl/tplimpl.(*TemplateStore).transformTemplates.(*TemplateStore).transformTemplates.(*TemplateStore).templates.func2-range3({0xc00016ea20?, 0x8?}, 0xdd769d031d8f1d35?)
        /root/project/hugo/tpl/tplimpl/templatestore.go:1538 +0xb7
github.com/gohugoio/hugo/tpl/tplimpl.(*TemplateStore).transformTemplates.(*TemplateStore).transformTemplates.(*TemplateStore).templates.func2.(*TemplateStore).transformTemplates.(*TemplateStore).transformTemplates.(*TemplateStore).templates.func2.(*SimpleTree[...]).All.func3.func4({0x1e527e0?, 0xc000402600?})
        /root/project/hugo/hugolib/doctree/simpletree.go:118 +0x39
github.com/armon/go-radix.recursiveWalk(0xc000402630, 0xc000057000)
        /root/project/gomodcache/github.com/armon/[email protected]/radix.go:523 +0x43
github.com/armon/go-radix.recursiveWalk(0xc000402a80, 0xc000057000)
        /root/project/gomodcache/github.com/armon/[email protected]/radix.go:532 +0x93
github.com/armon/go-radix.recursiveWalk(0xc0004029c0, 0xc000057000)
        /root/project/gomodcache/github.com/armon/[email protected]/radix.go:532 +0x93
github.com/armon/go-radix.recursiveWalk(0xc000402870, 0xc000057000)
        /root/project/gomodcache/github.com/armon/[email protected]/radix.go:532 +0x93
github.com/armon/go-radix.recursiveWalk(0xc000402690, 0xc000057000)
        /root/project/gomodcache/github.com/armon/[email protected]/radix.go:532 +0x93
github.com/armon/go-radix.recursiveWalk(0xc0003dd9e0, 0xc000057000)
        /root/project/gomodcache/github.com/armon/[email protected]/radix.go:532 +0x93
github.com/armon/go-radix.(*Tree).Walk(...)
        /root/project/gomodcache/github.com/armon/[email protected]/radix.go:453
github.com/gohugoio/hugo/tpl/tplimpl.(*TemplateStore).transformTemplates.(*TemplateStore).transformTemplates.(*TemplateStore).templates.func2.(*SimpleTree[...]).All.func3(...)
        /root/project/hugo/hugolib/doctree/simpletree.go:117
github.com/gohugoio/hugo/tpl/tplimpl.(*TemplateStore).transformTemplates.(*TemplateStore).templates.func2(...)
        /root/project/hugo/tpl/tplimpl/templatestore.go:1529
github.com/gohugoio/hugo/tpl/tplimpl.(*TemplateStore).transformTemplates(0xc000304a88)
        /root/project/hugo/tpl/tplimpl/templatestore.go:1684 +0x18f
github.com/gohugoio/hugo/tpl/tplimpl.NewStore({{0x257e320, 0xc000032190}, {0x25880f8, 0xc000542140}, 0xc0004a17a0, {0x0, 0x0}, {0xc0003ea008, 0xf, 0xf}, ...}, ...)
        /root/project/hugo/tpl/tplimpl/templatestore.go:135 +0x626
github.com/gohugoio/hugo/hugolib.newHugoSites({{0x0, 0x0}, 0x4, {0x255dc80, 0xc000092040}, {0x255dc80, 0xc000092038}, 0xc00057c770, {0x0, 0x0}, ...}, ...)
        /root/project/hugo/hugolib/site.go:396 +0x885
github.com/gohugoio/hugo/hugolib.NewHugoSites({{0x0, 0x0}, 0x4, {0x255dc80, 0xc000092040}, {0x255dc80, 0xc000092038}, 0xc00057c770, {0x0, 0x0}, ...})
        /root/project/hugo/hugolib/site.go:329 +0x16c5
github.com/gohugoio/hugo/commands.(*rootCommand).HugFromConfig.func1({0xa3c40?, 0xc0?})
        /root/project/hugo/commands/commandeer.go:337 +0x78
github.com/bep/lazycache.(*Cache[...]).GetOrCreate.func1(0xc000057cca?, 0x0, {0x3fc750?, 0xc0?}, 0x4f0c85?, 0x37f42a0?)
        /root/project/gomodcache/github.com/bep/[email protected]/lazycache.go:143 +0xa5
github.com/bep/lazycache.(*Cache[...]).GetOrCreate(0x2593580, {0x8dd28, 0xc0?}, 0xc0000a3d20?)
        /root/project/gomodcache/github.com/bep/[email protected]/lazycache.go:147 +0x15e
github.com/gohugoio/hugo/commands.(*rootCommand).HugFromConfig(0x0?, 0x0?)
        /root/project/hugo/commands/commandeer.go:335 +0x3e
github.com/gohugoio/hugo/commands.(*hugoBuilder).hugo.func1(0x30?)
        /root/project/hugo/commands/hugobuilder.go:1003 +0x29
github.com/gohugoio/hugo/commands.(*hugoBuilder).withConfE(0xc000095808?, 0xc000095d30?)
        /root/project/hugo/commands/hugobuilder.go:86 +0x8e
github.com/gohugoio/hugo/commands.(*hugoBuilder).hugo(0xc00056e100)
        /root/project/hugo/commands/hugobuilder.go:1001 +0x45
github.com/gohugoio/hugo/commands.(*hugoBuilder).doWithPublishDirs(0xc00056e100, 0xc000057f08)
        /root/project/hugo/commands/hugobuilder.go:487 +0x45
github.com/gohugoio/hugo/commands.(*hugoBuilder).copyStatic(0x0?)
        /root/project/hugo/commands/hugobuilder.go:430 +0x29
github.com/gohugoio/hugo/commands.(*hugoBuilder).fullBuild.func2()
        /root/project/hugo/commands/hugobuilder.go:534 +0x25
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /root/project/gomodcache/golang.org/x/[email protected]/errgroup/errgroup.go:79 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
        /root/project/gomodcache/golang.org/x/[email protected]/errgroup/errgroup.go:76 +0x93

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions