Upgrading to 0.19 -- Need help tracking down a stacktrace

Hello – We are very happy with hugo and have deployed our corporate site with it on version 0.16 and everything is working great. I am now interested in upgrading to 0.19 and we are getting a very cryptic stacktrace on build with no real pointers on how to begin to figure it out. I am wondering if anyone has seen this kind of thing before and if there you can provide any hints on getting to the source of the issue. Here is the output from my local build –

Started building sites ...
WARNING: Page's Now is deprecated and will be removed in a future release. Use now (the template func).
panic: reflect: call of reflect.Value.Type on zero Value [recovered]
	panic: reflect: call of reflect.Value.Type on zero Value

goroutine 343 [running]:
text/template.errRecover(0xc4237f1a78)
	/usr/lib/go/src/text/template/exec.go:146 +0x62
panic(0xa9ec60, 0xc423a02c60)
	/usr/lib/go/src/runtime/panic.go:489 +0x2cf
reflect.Value.Type(0x0, 0x0, 0x0, 0xa775a0, 0xc420d37b10)
	/usr/lib/go/src/reflect/value.go:1682 +0x21f
github.com/spf13/hugo/tpl/tplimpl.in(0xa6d420, 0xc420d15de0, 0x0, 0x0, 0x0)
	/tmp/yaourt-tmp-donovan/aur-hugo/src/src/github.com/spf13/hugo/tpl/tplimpl/template_funcs.go:458 +0x338
reflect.Value.call(0xa95280, 0xb87988, 0x13, 0xb51ab7, 0x4, 0xc421059dd0, 0x2, 0x2, 0xc4220ec180, 0xc420ffe088, ...)
	/usr/lib/go/src/reflect/value.go:434 +0x91f
reflect.Value.Call(0xa95280, 0xb87988, 0x13, 0xc421059dd0, 0x2, 0x2, 0xe93700, 0xc42051e600, 0xa98820)
	/usr/lib/go/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc4237f19f8, 0xa98820, 0xc4220ecf80, 0x94, 0xa95280, 0xb87988, 0x13, 0xe93220, 0xc42051e540, 0xc4205200b4, ...)
	/usr/lib/go/src/text/template/exec.go:668 +0x51f
text/template.(*state).evalFunction(0xc4237f19f8, 0xa98820, 0xc4220ecf80, 0x94, 0xc42051e570, 0xe93220, 0xc42051e540, 0xc42051d240, 0x3, 0x4, ...)
	/usr/lib/go/src/text/template/exec.go:536 +0x18e
text/template.(*state).evalCommand(0xc4237f19f8, 0xa98820, 0xc4220ecf80, 0x94, 0xc42051e540, 0x0, 0x0, 0x0, 0x1a, 0x3, ...)
	/usr/lib/go/src/text/template/exec.go:433 +0x6cd
text/template.(*state).evalPipeline(0xc4237f19f8, 0xa98820, 0xc4220ecf80, 0x94, 0xc4203e7f90, 0xc4208f32aa, 0xc4237f1328, 0x5cfb33)
	/usr/lib/go/src/text/template/exec.go:406 +0xf2
text/template.(*state).walkIfOrWith(0xc4237f19f8, 0xa, 0xa98820, 0xc4220ecf80, 0x94, 0xc4203e7f90, 0xc42051e630, 0x0)
	/usr/lib/go/src/text/template/exec.go:261 +0xbc
text/template.(*state).walk(0xc4237f19f8, 0xa98820, 0xc4220ecf80, 0x94, 0xe933a0, 0xc42051d600)
	/usr/lib/go/src/text/template/exec.go:237 +0x377
text/template.(*state).walk(0xc4237f19f8, 0xa98820, 0xc4220ecf80, 0x94, 0xe93400, 0xc42051e510)
	/usr/lib/go/src/text/template/exec.go:240 +0x139
text/template.(*state).walkRange.func1(0xa775a0, 0xc4220ecb30, 0x98, 0xa98820, 0xc4220ecf80, 0x94)
	/usr/lib/go/src/text/template/exec.go:327 +0x136
text/template.(*state).walkRange(0xc4237f19f8, 0xb4f360, 0xc42188fd00, 0x196, 0xc42051d640)
	/usr/lib/go/src/text/template/exec.go:344 +0x5a2
text/template.(*state).walk(0xc4237f19f8, 0xb4f360, 0xc42188fd00, 0x196, 0xe93580, 0xc42051d640)
	/usr/lib/go/src/text/template/exec.go:243 +0x4f1
text/template.(*state).walk(0xc4237f19f8, 0xb4f360, 0xc42188fd00, 0x196, 0xe93400, 0xc42051e360)
	/usr/lib/go/src/text/template/exec.go:240 +0x139
text/template.(*state).walkRange.func1(0xa76ce0, 0xc4220ec140, 0x82, 0xb4f360, 0xc42188fd00, 0x196)
	/usr/lib/go/src/text/template/exec.go:327 +0x136
text/template.(*state).walkRange(0xc4230899f8, 0xb4f360, 0xc421c9f680, 0x16, 0xc42051d680)
	/usr/lib/go/src/text/template/exec.go:336 +0x34e
text/template.(*state).walk(0xc4230899f8, 0xb4f360, 0xc421c9f680, 0x16, 0xe93580, 0xc42051d680)
	/usr/lib/go/src/text/template/exec.go:243 +0x4f1
text/template.(*state).walk(0xc4237f19f8, 0xb4f360, 0xc421c9f680, 0x16, 0xe93400, 0xc42051e150)
	/usr/lib/go/src/text/template/exec.go:240 +0x139
text/template.(*Template).execute(0xc42051ce80, 0xe89080, 0xc4239576c0, 0xb4f360, 0xc421c9f680, 0x0, 0x0)
	/usr/lib/go/src/text/template/exec.go:195 +0x20a
text/template.(*Template).Execute(0xc42051ce80, 0xe89080, 0xc4239576c0, 0xb4f360, 0xc421c9f680, 0xc4211e4480, 0x1f)
	/usr/lib/go/src/text/template/exec.go:178 +0x53
html/template.(*Template).Execute(0xc42051e0f0, 0xe89080, 0xc4239576c0, 0xb4f360, 0xc421c9f680, 0x1f, 0xc42051e0f0)
	/usr/lib/go/src/html/template/template.go:120 +0x8c
github.com/spf13/hugo/hugolib.(*Site).renderThing(0xc4200a4280, 0xb4f360, 0xc421c9f680, 0xc4211e4480, 0x1f, 0xe89080, 0xc4239576c0, 0x0, 0xc4240f5be0)
	/tmp/yaourt-tmp-donovan/aur-hugo/src/src/github.com/spf13/hugo/hugolib/site.go:1890 +0x9a
github.com/spf13/hugo/hugolib.(*Site).renderForLayouts(0xc4200a4280, 0xc4240f5c60, 0x1c, 0xb4f360, 0xc421c9f680, 0xe89080, 0xc4239576c0, 0xc42342f780, 0x8, 0x8, ...)
	/tmp/yaourt-tmp-donovan/aur-hugo/src/src/github.com/spf13/hugo/hugolib/site.go:1862 +0xcd
github.com/spf13/hugo/hugolib.(*Site).renderAndWritePage(0xc4200a4280, 0xc4240f5c60, 0x1c, 0xc4240f5b60, 0x19, 0xb4f360, 0xc421c9f680, 0xc42342f780, 0x8, 0x8, ...)
	/tmp/yaourt-tmp-donovan/aur-hugo/src/src/github.com/spf13/hugo/hugolib/site.go:1768 +0x105
github.com/spf13/hugo/hugolib.pageRenderer(0xc4200a4280, 0xc421960240, 0xc421960120, 0xc420f61790)
	/tmp/yaourt-tmp-donovan/aur-hugo/src/src/github.com/spf13/hugo/hugolib/site_render.go:70 +0x3b6
created by github.com/spf13/hugo/hugolib.(*Site).renderPages
	/tmp/yaourt-tmp-donovan/aur-hugo/src/src/github.com/spf13/hugo/hugolib/site_render.go:42 +0x156

Thanks!

The nil pointer looks to come from here:

It should probably have been handled better, but this func is pretty widely used, so you must do something “special” – which is impossible to tell without seing the full source.

But look for use of the in template func.

Cool, thanks. We’ve tracked down all the ‘in’ calls and it builds find without them. We will now start restoring them until we find the culprit(s)… Thanks again.