I’ll file an upstream bug on this, but it took a while to figure out which line in my latest blog post triggered a lengthy stack trace (--debug
and --verbose
don’t help at all). I had to binary-search with deletes to find it and strip it down to a minimal example:
# *~~a~~ b*
hugo v0.110.0+extended darwin/amd64 BuildDate=unknown
ERROR 2023/01/25 10:29:43 [BUG] Got panic:
runtime error: index out of range [31] with length 20
goroutine 178 [running]:
runtime/debug.Stack()
runtime/debug/stack.go:24 +0x65
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func1.1()
github.com/gohugoio/hugo/hugolib/page__per_output.go:101 +0xaa
panic({0x101c9d160, 0xc00182c138})
runtime/panic.go:884 +0x212
github.com/yuin/goldmark/renderer.(*renderer).Render.func2({0x10247d648, 0xc001b431f0}, 0x0?)
github.com/yuin/goldmark@v1.5.3/renderer/renderer.go:164 +0xd9
github.com/yuin/goldmark/ast.walkHelper({0x10247d648, 0xc001b431f0}, 0xc001c374f8)
github.com/yuin/goldmark@v1.5.3/ast/ast.go:492 +0x34
github.com/yuin/goldmark/ast.walkHelper({0x10247bea8, 0xc002615080}, 0xc001c374f8)
github.com/yuin/goldmark@v1.5.3/ast/ast.go:498 +0x8e
github.com/yuin/goldmark/ast.Walk(...)
github.com/yuin/goldmark@v1.5.3/ast/ast.go:487
github.com/yuin/goldmark/renderer.(*renderer).Render(0xc00049c820?, {0x102451320?, 0xc0005e69f0?}, {0xc00297a000?, 0x8bf?, 0x125e?}, {0x10247bea8?, 0xc002615080?})
github.com/yuin/goldmark@v1.5.3/renderer/renderer.go:161 +0x225
github.com/gohugoio/hugo/markup/goldmark.(*tocTransformer).Transform.func1({0x10247bea8, 0xc002615080}, 0x1)
github.com/gohugoio/hugo/markup/goldmark/toc.go:89 +0x3ad
github.com/yuin/goldmark/ast.walkHelper({0x10247bea8, 0xc002615080}, 0xc001c37738)
github.com/yuin/goldmark@v1.5.3/ast/ast.go:492 +0x34
github.com/yuin/goldmark/ast.walkHelper({0x10247c208, 0xc001a16870}, 0xc001c37738)
github.com/yuin/goldmark@v1.5.3/ast/ast.go:498 +0x8e
github.com/yuin/goldmark/ast.walkHelper({0x10247bd88, 0xc001a16360}, 0xc001c37738)
github.com/yuin/goldmark@v1.5.3/ast/ast.go:498 +0x8e
github.com/yuin/goldmark/ast.Walk(...)
github.com/yuin/goldmark@v1.5.3/ast/ast.go:487
github.com/gohugoio/hugo/markup/goldmark.(*tocTransformer).Transform(0xc000437e90?, 0x10247bd88?, {0x102472e90?, 0xc001b42a10?}, {0x1024744e0?, 0xc0026b99a0?})
github.com/gohugoio/hugo/markup/goldmark/toc.go:52 +0x19e
github.com/yuin/goldmark/parser.(*parser).Parse(0xc000980000, {0x102472e90, 0xc001b42a10}, {0xc0018145d8, 0x1, 0xc001c4acc0?})
github.com/yuin/goldmark@v1.5.3/parser/parser.go:882 +0x2f9
github.com/gohugoio/hugo/markup/goldmark.(*goldmarkConverter).Convert(0xc00290c800, {{0xc00297a000, 0x8bf, 0x125e}, 0x1, 0xc001c4acc0})
github.com/gohugoio/hugo/markup/goldmark/convert.go:184 +0x215
github.com/gohugoio/hugo/hugolib.(*pageContentOutput).renderContentWithConverter(0xc001550380, {0x10245dbc8?, 0xc00290c800?}, {0xc00297a000?, 0xc00071c2a0?, 0x19?}, 0xe5?)
github.com/gohugoio/hugo/hugolib/page__per_output.go:641 +0xa3
github.com/gohugoio/hugo/hugolib.(*pageContentOutput).RenderContent(0xc001550380, {0xc00297a000, 0x8bf, 0x125e}, 0x1?)
github.com/gohugoio/hugo/hugolib/page__per_output.go:637 +0x8a
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func1()
github.com/gohugoio/hugo/hugolib/page__per_output.go:126 +0x317
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func2({0x7669643c0a0a0a3e?, 0x223d6e67696c6120?})
github.com/gohugoio/hugo/hugolib/page__per_output.go:201 +0x1b
github.com/gohugoio/hugo/lazy.(*Init).withTimeout.func1()
github.com/gohugoio/hugo/lazy/init.go:188 +0x3c
created by github.com/gohugoio/hugo/lazy.(*Init).withTimeout
github.com/gohugoio/hugo/lazy/init.go:187 +0x11e
Error: Error building site: "/Users/jgreely/dotclue/preview/post/0068/006847.md:1:1": runtime error: index out of range [31] with length 20