Panic: runtime error: invalid memory address or nil pointer dereference in Hugo 0.132.0

I just upgraded to Hugo 0.132.0 via Brew, and when I start the server I get the following error:

hugo v0.132.0+extended darwin/arm64 BuildDate=2024-08-12T15:21:36Z VendorInfo=brew

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x88 pc=0x102b2dee0]

goroutine 4521 [running]:
github.com/gohugoio/hugo/markup/goldmark/blockquotes.(*htmlRenderer).renderBlockquote(0x1076c8300, {0x105f4e2d0, 0x14003d7c0f0}, {0x14003743000, 0xb40?, 0xe56}, {0x105f68260?, 0x14002d39200}, 0x0?)
        github.com/gohugoio/hugo/markup/goldmark/blockquotes/blockquotes.go:81 +0x220
github.com/yuin/goldmark/renderer.(*renderer).Render.func2({0x105f68260, 0x14002d39200}, 0x0)
        github.com/yuin/goldmark@v1.7.4/renderer/renderer.go:166 +0xb4
github.com/yuin/goldmark/ast.walkHelper({0x105f68260, 0x14002d39200}, 0x14005743830)
        github.com/yuin/goldmark@v1.7.4/ast/ast.go:503 +0xc0
github.com/yuin/goldmark/ast.walkHelper({0x105f674e0, 0x14005704900}, 0x14005743830)
        github.com/yuin/goldmark@v1.7.4/ast/ast.go:498 +0x8c
github.com/yuin/goldmark/ast.Walk(...)
        github.com/yuin/goldmark@v1.7.4/ast/ast.go:487
github.com/yuin/goldmark/renderer.(*renderer).Render(0x14000b8b5e0, {0x105f29020, 0x14003d7c0f0}, {0x14003743000, 0xb40, 0xe56}, {0x105f674e0, 0x14005704900})
        github.com/yuin/goldmark@v1.7.4/renderer/renderer.go:161 +0x1c8
github.com/gohugoio/hugo/markup/goldmark.(*goldmarkConverter).Render(0x1400572c0b0, {{0x105f43128, 0x1400573a000}, {0x14003743000, 0xb40, 0xe56}, 0x1, 0x1400573a0c0}, {0x105ec9140?, 0x14005704900})
        github.com/gohugoio/hugo/markup/goldmark/convert.go:270 +0x228
github.com/gohugoio/hugo/hugolib.(*pageContentOutput).RenderContent(0x140018a4360, {0x105f43128, 0x1400573a000}, {0x14003743000, 0xb40, 0xe56}, {0x105ec9140, 0x14005704900})
        github.com/gohugoio/hugo/hugolib/page__per_output.go:620 +0x10c
github.com/gohugoio/hugo/hugolib.(*cachedContent).contentRendered.func1({0x1400086eea8?, 0x105f77ec0?})
        github.com/gohugoio/hugo/hugolib/page__content.go:541 +0x248
github.com/bep/lazycache.(*Cache[...]).GetOrCreate(0x105f6cae0, {0x14003770100, 0x74}, 0x1400268bd78)
        github.com/bep/lazycache@v0.4.0/lazycache.go:125 +0x13c
github.com/gohugoio/hugo/cache/dynacache.(*Partition[...]).doGetOrCreate(...)
        github.com/gohugoio/hugo/cache/dynacache/dynacache.go:410
github.com/gohugoio/hugo/cache/dynacache.(*Partition[...]).GetOrCreate(0x105f71a00, {0x14003770100, 0x74}, 0x14005743d78)
        github.com/gohugoio/hugo/cache/dynacache/dynacache.go:398 +0x44
github.com/gohugoio/hugo/hugolib.(*cachedContent).contentRendered(0x140017040c0, {0x105f43128?, 0x14003d0f6e0?}, 0x140018a4360)
        github.com/gohugoio/hugo/hugolib/page__content.go:512 +0x134
github.com/gohugoio/hugo/hugolib.(*cachedContent).contentPlain.func1({0x1400086ef08?, 0x105f77c80?})
        github.com/gohugoio/hugo/hugolib/page__content.go:765 +0xf0
github.com/bep/lazycache.(*Cache[...]).GetOrCreate(0x105f6c960, {0x14003770000, 0x74}, 0x1400373ad20)
        github.com/bep/lazycache@v0.4.0/lazycache.go:125 +0x13c
github.com/gohugoio/hugo/cache/dynacache.(*Partition[...]).doGetOrCreateWitTimeout.func1()
        github.com/gohugoio/hugo/cache/dynacache/dynacache.go:433 +0x50
created by github.com/gohugoio/hugo/cache/dynacache.(*Partition[...]).doGetOrCreateWitTimeout in goroutine 4519
        github.com/gohugoio/hugo/cache/dynacache/dynacache.go:432 +0xf4

I added the new Blockquote render hooks config to my config.toml and copied the code in the documentation for layouts/_default/_markup/render-blockquote.html but this seems to be unrelated to those changes, because I get the same problem even after reverting back those files.

See Check blockquotes nilpointer · Issue #12756 · gohugoio/hugo · GitHub

This is very odd, as we have certainly tested this on many sites without similar issues … OK, I see it now, I guess you have an empty blockquote.

Oh, an empty blockquote in an existing post? That’ll be easy to track down… :wink:

Let me know if you want me to test something, I’ve only tested this locally on my MacBook and have not deployed to my live site on Netlify yet, naturally.

The issue was easy to locate and fix: Fix nilpointer regression with empty blockquotes by bep · Pull Request #12757 · gohugoio/hugo · GitHub

I will push a patch release later today.

Awesome, thanks @bep! I’ll test as soon as a new build is available in Brew. :slight_smile:

1 Like

Saw 0.132.1 was available now, and I can confirm that it now works. My site renders properly locally again. Thanks for the quick turnaround @bep :slight_smile:

1 Like

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