New in 0.42 : Failed to render "_default/list.html": programming error: no mainPageOutput

Hello,

I have a change since 0.42.1 (no problem in 0.41).

  • The site build correctly in hugo server mode
  • If I change something on a shortcode the site rebuilds with this error (see below)
  • No error reported when using the hugo command for generating the HTML.
  • On 0.43 same problem but I got a stacktrace (see below)
  • It doesn’t seems to happen if I change a regular .md file

I found no mainPageOutput trace on discourse.
Any info, tip, idea about this problem ?

Error in 0.42.1

hugo server --disableFastRender --ignoreCache

                   | FR
+------------------+-----+
  Pages            | 172
  Paginator pages  |   6
  Non-page files   | 370
  Static files     | 237
  Processed images |   0
  Aliases          |   3
  Sitemaps         |   1
  Cleaned          |   0

Total in 1174 ms
Watching for changes in /Users/didiergeorgieff/Documents/Git/documentation/doc-adhoc-gti/adhoc/{content,layouts,static,themes}
Watching for config changes in /Users/didiergeorgieff/Documents/Git/documentation/doc-adhoc-gti/adhoc/config.toml
Serving pages from memory
Web Server is available at http://localhost:1313/adhoc/v1/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Change detected, rebuilding site
2018-07-10 17:11:20.020 +0200
Template changed "/Users/didiergeorgieff/Documents/Git/documentation/doc-adhoc-gti/adhoc/layouts/shortcodes/children.html": WRITE
ERROR 2018/07/10 17:11:21 Failed to render "_default/list.html": programming error: no mainPageOutput for "technique/prerequis/_index.md"
Total in 1654 ms
ERROR 2018/07/10 17:11:21 Failed to rebuild site: logged 1 error(s)

Error in 0.43

$ hugo server --disableFastRender --ignoreCache

                   | FR
+------------------+-----+
  Pages            | 172
  Paginator pages  |   6
  Non-page files   | 370
  Static files     | 237
  Processed images |   0
  Aliases          |   3
  Sitemaps         |   1
  Cleaned          |   0

Total in 1189 ms
Watching for changes in /Users/didiergeorgieff/Documents/Git/documentation/doc-adhoc-gti/adhoc/{content,layouts,static,themes}
Watching for config changes in /Users/didiergeorgieff/Documents/Git/documentation/doc-adhoc-gti/adhoc/config.toml
Serving pages from memory
Web Server is available at http://localhost:1313/adhoc/v1/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Change detected, rebuilding site
2018-07-10 17:39:59.268 +0200
Template changed "/Users/didiergeorgieff/Documents/Git/documentation/doc-adhoc-gti/adhoc/themes/docdock/layouts/shortcodes/children.html": WRITE
ERROR 2018/07/10 17:40:00 Failed to render "_default/list.html": programming error: no mainPageOutput for "technique/prerequis/_index.md"
ERROR 2018/07/10 17:40:00 Stack Trace:
goroutine 887 [running]:
github.com/gohugoio/hugo/hugolib.stackTrace(0x4b0, 0x1afa775, 0x17)
        /private/tmp/hugo-20180710-27145-1i8gb8k/hugo-0.43/src/github.com/gohugoio/hugo/hugolib/page.go:280 +0x76
github.com/gohugoio/hugo/hugolib.(*Site).renderForLayouts.func1(0xc4266ed4b0, 0xc4204d0300)
        /private/tmp/hugo-20180710-27145-1i8gb8k/hugo-0.43/src/github.com/gohugoio/hugo/hugolib/site.go:1733 +0x135
panic(0x197a200, 0xc42050e260)
        /usr/local/Cellar/go/1.10.3/libexec/src/runtime/panic.go:502 +0x229
text/template.errRecover(0xc4266ed3a0)
        /usr/local/Cellar/go/1.10.3/libexec/src/text/template/exec.go:143 +0x1ba
panic(0x197a200, 0xc42050e260)
        /usr/local/Cellar/go/1.10.3/libexec/src/runtime/panic.go:502 +0x229
github.com/gohugoio/hugo/hugolib.(*Page).Render(0xc422761400, 0xc42050e240, 0x1, 0x1, 0x0, 0x0)
        /private/tmp/hugo-20180710-27145-1i8gb8k/hugo-0.43/src/github.com/gohugoio/hugo/hugolib/page_output.go:159 +0x163
reflect.Value.call(0x1aa7600, 0xc422761400, 0xf213, 0x1aad115, 0x4, 0xc42050cfc0, 0x1, 0x1, 0x1aa1f20, 0x1, ...)
        /usr/local/Cellar/go/1.10.3/libexec/src/reflect/value.go:447 +0x969
reflect.Value.Call(0x1aa7600, 0xc422761400, 0xf213, 0xc42050cfc0, 0x1, 0x1, 0x1c88800, 0xc424
Total in 1363 ms
ERROR 2018/07/10 17:40:00 Failed to rebuild site: logged 2 error(s)

What do you .Render? Is it pages inside bundles? Other than that you need to show the full source (link to GitHub) for anyone to help you with this.

I’m currently having the same issue. In my case I’m attempting to use .Render on a page inside a headless bundle. The pages content files are entirely made of front matter with no actual content, I’m not sure how relevant that might be to the issue?

This is the block that I have within my list.html:

    {{ with ( .Site.GetPage "page" "blocks" ) }}
        {{ range .Resources.Match "*" }}
            {{ .Render "single" }}
        {{ end }}
    {{ end }}