Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hugo panic when running hugo --buildDrafts on v0.100.0+ when using markdownify in templates #9959

Closed
kaushalmodi opened this issue May 31, 2022 · 7 comments · Fixed by #9960
Assignees
Milestone

Comments

@kaushalmodi
Copy link
Contributor

kaushalmodi commented May 31, 2022

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

$ hugo version
hugo v0.101.0-DEV-4daac654d90bdc6adf92bf8b15a4aa45d7d62efd linux/amd64 BuildDate=2022-05-31T09:19:15Z

Does this issue reproduce with the latest release?

Yes.

Issue

When running hugo --buildDrafts or hugo serve --buildDrafts on my site, I get a bunch of panic backtraces like this:

Click to see the backtrace
ERR: runtime error: invalid memory address or nil pointer dereference
stacktrace from panic:
goroutine 142 [running]:
runtime/debug.Stack()
        /home/kmodi/go/src/runtime/debug/stack.go:24 +0x65
github.com/gohugoio/hugo/common/herrors.Recover({0x0, 0x0, 0x0})
        /home/kmodi/downloads/git/hugo/common/herrors/errors.go:45 +0x9c
panic({0x1df9e40, 0x36491e0})
        /home/kmodi/go/src/runtime/panic.go:838 +0x207
github.com/gohugoio/hugo/hugolib.(*shortcodeHandler).transferNames(0x0, 0xc002708370)
        /home/kmodi/downloads/git/hugo/hugolib/shortcode.go:461 +0x4a
github.com/gohugoio/hugo/hugolib.(*pageContentOutput).RenderString(0xc0013f0700, {0xc003cab020, 0x1, 0x7f35c27b4d01?})
        /home/kmodi/downloads/git/hugo/hugolib/page__per_output.go:442 +0xa11
github.com/gohugoio/hugo/tpl/transform.(*Namespace).Markdownify(0xc000a7e0d0, {0x1d4f6e0?, 0xc003caaf70})
        /home/kmodi/downloads/git/hugo/tpl/transform/transform.go:127 +0xae
reflect.Value.call({0x1daa740?, 0xc000a7e170?, 0xc000631ea0?}, {0x203d311, 0x4}, {0xc00257b050, 0x1, 0x260d640?})
        /home/kmodi/go/src/reflect/value.go:556 +0x845
reflect.Value.Call({0x1daa740?, 0xc000a7e170?, 0x0?}, {0xc00257b050, 0x1, 0x1})
        /home/kmodi/go/src/reflect/value.go:339 +0xbf
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.safeCall({0x1daa740?, 0xc000a7e170?, 0xc003caaf70?}, {0xc00257b050?, 0x260d640?, 0x1db3380?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/funcs.go:368 +0x9d
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCall(0xc0028a88a8, {0x202fe60?, 0xc000df40f0?, 0x1245509?}, {0x1daa740?, 0xc000a7e170?, 0xc?}, 0x0, {0x2604098, 0xc0005bda10}, ...)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:386 +0xb0a
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalFunction(0xc005d4e8a8, {0x202fe60?, 0xc000df40f0?, 0x1?}, 0x1?, {0x2604098, 0xc0005bda10}, {0xc0002488b0, 0x1, 0x1}, ...)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:180 +0x46e
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCommand(0xc005d4e8a8, {0x202fe60?, 0xc000df40f0?, 0x0?}, 0xc005d4e8a8?, {0x1d4f6e0?, 0xc003caaf70?, 0xc00257af78?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:488 +0xea
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalPipeline(0xc0028a88a8, {0x202fe60?, 0xc000df40f0?, 0x0?}, 0xc0005b5a40)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:457 +0x145
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028a88a8, {0x202fe60?, 0xc000df40f0?, 0x1e156e0?}, {0x2603f30?, 0xc00078ad50})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:261 +0x225
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028a88a8, {0x202fe60?, 0xc000df40f0?, 0x1d31920?}, {0x2604290?, 0xc0005bd950?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkIfOrWith(0xc005d4e8a8, 0xa, {0x202fe60?, 0xc000df40f0?, 0xc0005b5800?}, 0x2?, 0x2?, 0xc0005bd950)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:307 +0x17c
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc005d4e8a8, {0x202fe60?, 0xc000df40f0?, 0x1e156e0?}, {0x2604248?, 0xc000787280?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:271 +0x1d6
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028a88a8, {0x202fe60?, 0xc000df40f0?, 0x1d31920?}, {0x2604290?, 0xc0005bd350?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkIfOrWith(0xc005d4e8a8, 0xa, {0x202fe60?, 0xc000df40f0?, 0xc0005b5560?}, 0x18?, 0x99?, 0xc00078ad80)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:304 +0x14a
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc005d4e8a8, {0x202fe60?, 0xc000df40f0?, 0x1e156e0?}, {0x2604248?, 0xc000787300?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:271 +0x1d6
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028a88a8, {0x202fe60?, 0xc000df40f0?, 0x1d4f6e0?}, {0x2604290?, 0xc0005bd170?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkIfOrWith(0xc005d4e8a8, 0x13, {0x202fe60?, 0xc000df40f0?, 0xc0005b5440?}, 0xdb6db6db6db6d?, 0xc0025731d0?, 0xc0005bd170)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:307 +0x17c
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc005d4e8a8, {0x202fe60?, 0xc000df40f0?, 0x3?}, {0x2604518?, 0xc000787340?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:285 +0x154
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028a88a8, {0x202fe60?, 0xc000df40f0?, 0xc00257ade0?}, {0x2604290?, 0xc0005bce10?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*Template).executeWithState(0xc00255f890?, 0x1d4cda0?, {0x202fe60?, 0xc000df40f0?, 0x50001?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:136 +0x135
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*executer).ExecuteWithContext(0xc000a7e310, {0x2601860, 0xc00255f890}, {0x7f359b5a8248, 0xc000c114a0}, {0x25f01c0, 0xc0022c0060}, {0x202fe60, 0xc000df40f0})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:101 +0x345
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).ExecuteWithContext(0xc000809350, {0x2601860, 0xc00255f890}, {0x25fa9f0?, 0xc000c114a0}, {0x25f01c0, 0xc0022c0060}, {0x202fe60, 0xc000df40f0})
        /home/kmodi/downloads/git/hugo/tpl/tplimpl/template.go:258 +0x59e
github.com/gohugoio/hugo/tpl/partials.(*Namespace).include(0xc000a555b0, {0x2601860, 0xc00255f890}, {0xc000c3617b, 0x16}, {0xc003caae60?, 0x10?, 0x7f35c27b4d28?})
        /home/kmodi/downloads/git/hugo/tpl/partials/partials.go:166 +0x335
github.com/gohugoio/hugo/tpl/partials.(*Namespace).Include(0xc000a555b0, {0x2601860?, 0xc00255f890?}, {0xc000c3617b?, 0x1e54700?}, {0xc003caae60?, 0xc005d4ed48?, 0x4de6de?})
        /home/kmodi/downloads/git/hugo/tpl/partials/partials.go:106 +0x39
reflect.Value.call({0x1df2d00?, 0xc000a555d0?, 0x1db3380?}, {0x203d311, 0x4}, {0xc0027081e0, 0x3, 0x260d640?})
        /home/kmodi/go/src/reflect/value.go:556 +0x845
reflect.Value.Call({0x1df2d00?, 0xc000a555d0?, 0xc000df40f0?}, {0xc0027081e0, 0x3, 0x3})
        /home/kmodi/go/src/reflect/value.go:339 +0xbf
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.safeCall({0x1df2d00?, 0xc000a555d0?, 0xc00255f890?}, {0xc0027081e0?, 0x260d640?, 0x1e54700?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/funcs.go:368 +0x9d
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCall(0xc0028a9b30, {0x202fe60?, 0xc000df40f0?, 0x1?}, {0x1df2d00?, 0xc000a555d0?, 0x4ea726?}, 0x0, {0x2604098, 0xc000cc5230}, ...)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:386 +0xb0a
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalFunction(0xc005d4fb30, {0x202fe60?, 0xc000df40f0?, 0xc003caae40?}, 0x47331e?, {0x2604098, 0xc000cc5230}, {0xc000cc28c0, 0x3, 0x4}, ...)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:178 +0x39d
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCommand(0xc005d4fb30, {0x202fe60?, 0xc000df40f0?, 0xc004afe000?}, 0x0?, {0x1df64e0?, 0x36e21d8?, 0x1247db3?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:488 +0xea
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalPipeline(0xc0028a9b30, {0x202fe60?, 0xc000df40f0?, 0x1d4f6e0?}, 0xc000cc1140)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:457 +0x145
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028a9b30, {0x202fe60?, 0xc000df40f0?, 0xc00255f890?}, {0x2603f30?, 0xc000cc5290})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:261 +0x225
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028a9b30, {0x202fe60?, 0xc000df40f0?, 0x0?}, {0x2604290?, 0xc000cc4d50?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*Template).executeWithState(0x26017f0?, 0xc000142000?, {0x202fe60?, 0xc000df40f0?, 0x202fe60?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:136 +0x135
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*executer).ExecuteWithContext(0xc000a7e310, {0x26017f0, 0xc000142000}, {0x7f359b5a8248, 0xc000c100f0}, {0x25f01c0, 0xc0049f7350}, {0x202fe60, 0xc000df40f0})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:101 +0x345
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).ExecuteWithContext(0xc000809350, {0x26017f0, 0xc000142000}, {0x25fa9f0?, 0xc000c100f0}, {0x25f01c0, 0xc0049f7350}, {0x202fe60, 0xc000df40f0})
        /home/kmodi/downloads/git/hugo/tpl/tplimpl/template.go:258 +0x59e
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).Execute(0x36525e0?, {0x25fa9f0?, 0xc000c100f0?}, {0x25f01c0?, 0xc0049f7350?}, {0x202fe60?, 0xc000df40f0?})
        /home/kmodi/downloads/git/hugo/tpl/tplimpl/template.go:230 +0x65
github.com/gohugoio/hugo/hugolib.executeToString({0x26062c0, 0xc000809350}, {0x25fa9f0, 0xc000c100f0}, {0x202fe60, 0xc000df40f0})
        /home/kmodi/downloads/git/hugo/hugolib/page__per_output.go:719 +0x102
github.com/gohugoio/hugo/hugolib.(*pageContentOutput).Render(0xc00137cfc0, {0xc00384d360?, 0x4?, 0x0?})
        /home/kmodi/downloads/git/hugo/hugolib/page__per_output.go:480 +0xdd
reflect.Value.call({0x202fe60?, 0xc000df40f0?, 0xc005d50640?}, {0x203d311, 0x4}, {0xc0025690f8, 0x1, 0xc005d50b00?})
        /home/kmodi/go/src/reflect/value.go:556 +0x845
reflect.Value.Call({0x202fe60?, 0xc000df40f0?, 0xc00384d320?}, {0xc0025690f8, 0x1, 0x1})
        /home/kmodi/go/src/reflect/value.go:339 +0xbf
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.safeCall({0x202fe60?, 0xc000df40f0?, 0xc00384d320?}, {0xc0025690f8?, 0x260d640?, 0x1d4f6e0?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/funcs.go:368 +0x9d
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCall(0xc0028ab2f0, {0x2012d20?, 0xc00384d320?, 0x8?}, {0x202fe60?, 0xc000df40f0?, 0x4?}, 0x0, {0x26041b8, 0xc001ac6390}, ...)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:386 +0xb0a
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalField(0xc005d512f0, {0x2012d20?, 0xc00384d320?, 0xc00384d330?}, {0xc000cc6b61, 0x6}, {0x26041b8, 0xc001ac6390}, {0xc002412f60, 0x2, ...}, ...)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:223 +0x55c
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalFieldChain(0x2f000000021f8870?, {0x2012d20?, 0xc00384d320?, 0xc0011cdfb0?}, {0x2012d20?, 0xc00384d320?, 0xc006663aa0?}, {0x26041b8, 0xc001ac6390}, {0xc001ffc080, ...}, ...)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:591 +0x1eb
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalFieldNode(0x13?, {0x2012d20?, 0xc00384d320?, 0x2601860?}, 0xc005d50ce8?, {0xc002412f60?, 0xc005d50e18?, 0x124f32e?}, {0x1df64e0, 0x36e21d8, ...})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:555 +0xce
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalCommand(0xc005d512f0, {0x2012d20?, 0xc00384d320?, 0xc000a54eb0?}, 0xc0011cdfb0?, {0x1df64e0?, 0x36e21d8?, 0x5?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:483 +0x296
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).evalPipeline(0xc0028ab2f0, {0x2012d20?, 0xc00384d320?, 0x99?}, 0xc0063fd7a0)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:457 +0x145
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028ab2f0, {0x2012d20?, 0xc00384d320?, 0x1244295?}, {0x2603f30?, 0xc001ac6510})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:261 +0x225
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028ab2f0, {0x2012d20?, 0xc00384d320?, 0x202fe60?}, {0x2604290?, 0xc001ac6300?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkRange.func2({0x1d4ed20?, 0x34a5a60?, 0xc0011cdfb0?}, {0x2012d20?, 0xc00384d320?, 0xc005d512f0?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:373 +0x17d
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkRange(0xc005d512f0, {0x202fe60?, 0xc0011cdfb0?, 0xc0011cdfb0?}, 0xc001a9cf40)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:381 +0x573
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc005d512f0, {0x202fe60?, 0xc0011cdfb0?, 0x202fe60?}, {0x26043b0?, 0xc001a9cf40?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:277 +0x28d
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028ab2f0, {0x202fe60?, 0xc0011cdfb0?, 0x0?}, {0x2604290?, 0xc00211b020?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walkTemplate(0xc005d515c8, {0x202fe60?, 0xc0011cdfb0?, 0x1d4f6e0?}, 0xc0056b4340)
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:439 +0x279
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc005d515c8, {0x202fe60?, 0xc0011cdfb0?, 0x3?}, {0x2604440?, 0xc0056b4340?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:279 +0x119
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*state).walk(0xc0028ab5c8, {0x202fe60?, 0xc0011cdfb0?, 0x0?}, {0x2604290?, 0xc0045f7410?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/exec.go:274 +0x415
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*Template).executeWithState(0x26017f0?, 0xc000142000?, {0x202fe60?, 0xc0011cdfb0?, 0x202fe60?})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:136 +0x135
github.com/gohugoio/hugo/tpl/internal/go_templates/texttemplate.(*executer).ExecuteWithContext(0xc000a7e310, {0x26017f0, 0xc000142000}, {0x7f359b5a8248, 0xc0023ec780}, {0x25f01c0, 0xc0037b77d0}, {0x202fe60, 0xc0011cdfb0})
        /home/kmodi/downloads/git/hugo/tpl/internal/go_templates/texttemplate/hugo_template.go:101 +0x345
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).ExecuteWithContext(0xc000809350, {0x26017f0, 0xc000142000}, {0x25fa9f0?, 0xc0023ec780}, {0x25f01c0, 0xc0037b77d0}, {0x202fe60, 0xc0011cdfb0})
        /home/kmodi/downloads/git/hugo/tpl/tplimpl/template.go:258 +0x59e
github.com/gohugoio/hugo/tpl/tplimpl.(*templateExec).Execute(0x93f6cc?, {0x25fa9f0?, 0xc0023ec780?}, {0x25f01c0?, 0xc0037b77d0?}, {0x202fe60?, 0xc0011cdfb0?})
        /home/kmodi/downloads/git/hugo/tpl/tplimpl/template.go:230 +0x65
github.com/gohugoio/hugo/hugolib.(*Site).renderForTemplate(0x2?, {0x203fae5, 0x4}, {0x203d64d?, 0x203d64d?}, {0x202fe60?, 0xc0011cdfb0?}, {0x25f01c0?, 0xc0037b77d0?}, {0x25fa9f0, ...})
        /home/kmodi/downloads/git/hugo/hugolib/site.go:1820 +0x92
github.com/gohugoio/hugo/hugolib.(*Site).renderAndWritePage(0xc00097db00, 0xc000119690, {0xc0052bb710, 0xf}, {0xc00141a7e0, 0x1b}, 0xc0011cdfb0, {0x25fa9f0, 0xc0023ec780})
        /home/kmodi/downloads/git/hugo/hugolib/site.go:1737 +0x2c8
github.com/gohugoio/hugo/hugolib.pageRenderer(0x122b925?, 0xc00097db00, 0xc000ac9fd0?, 0x122b8a6?, 0xc000568480?)
        /home/kmodi/downloads/git/hugo/hugolib/site_render.go:138 +0x287
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
        /home/kmodi/downloads/git/hugo/hugolib/site_render.go:74 +0x108

Steps to reproduce this

git clone https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io test
cd test
git checkout hugo-issue-9959
hugo --buildDrafts # or hugo server --buildDrafts

Other info

  1. This panic doesn't happen if --buildDrafts is not used.
  2. This panic doesn't happen even when I switch back to v0.99.1 and use --buildDrafts.
@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented May 31, 2022

I was able to narrow down the crash to the use of (i) .RawContent | markdownify in one of my template files, and (ii) use of the figure shortcode in a content file.

image

Here's a recipe with a much smaller codebase:

git clone https://gitlab.com/hugo-mwe/hugo-mwe
cd hugo-mwe
git checkout builddrafts-panic
hugo server --buildDrafts

Relevant commit: https://gitlab.com/hugo-mwe/hugo-mwe/-/commit/6f3a5cf71bd7d34f4829e5d8d3afb6d5c033d449

Workaround to prevent the crash

Use $.RenderString instead of markdownify.

@kaushalmodi kaushalmodi changed the title hugo panic when running hugo --buildDrafts on v0.100.0+ hugo panic when running hugo --buildDrafts on v0.100.0+ when using markdownify in templates May 31, 2022
@Wirone
Copy link

Wirone commented May 31, 2022

Same here. Unfortunately I can't use workaround because markdownify is used in PaperMod theme. I get 6 errors when I start server.. And I can't rollback since brew does not provide versioned formulas 😩

@kaushalmodi
Copy link
Contributor Author

Unfortunately I can't use workaround because markdownify is used in PaperMod theme.

You can override the partials and theme files in your site's layouts/ directory until this get fixed in Hugo.

@jmooring
Copy link
Member

@kaushalmodi

markdownify has been effectively aliased to site.Home.RenderString since v0.93.0.

With both of the test sites that you reference in this issue, the home page is not backed by a content file. I think you can work around this issue with:

hugo new _index.md

kaushalmodi added a commit to kaushalmodi/hugo-bare-min-theme that referenced this issue May 31, 2022
@bep bep self-assigned this Jun 1, 2022
@bep bep removed the NeedsTriage label Jun 1, 2022
@bep bep added this to the v0.100.1 milestone Jun 1, 2022
@bep
Copy link
Member

bep commented Jun 1, 2022

I will fix this and push a patch release later today.

@kaushalmodi
Copy link
Contributor Author

Thank you! I confirm the fix.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants