Closed kaushalmodi closed 6 years ago
Here's the _default/taxonomy.html
that seems to cause this panic, but not sure what's wrong in there. In any case, I should be getting a useful error.
{{ define "main" }} <!-- List of all posts -->
<!-- http://microformats.org/wiki/h-feed -->
<section class="h-feed">
<header>
{{ partialCached "all-terms.html" . }}
<!-- To complete the h-feed meta-data -->
<data class="u-url" value="{{ .Permalink }}"></data>
{{ partial "author.html" . }}
<!-- If the page is /tags/foo/, .Data.Plural = "tags", .Data.Term = "foo"
"%T" in the string retrieved from phrase map will be replaced with .Data.Term
"%N" in the string retrieved from phrase map will be replaced with .Name
-->
{{ $term := .Data.Term }}
{{ $phrase := (index .Site.Data.taxonomy.phrases .Data.Plural) | replaceRE "%T" (printf "‘%s’" $term) | replaceRE "%N" (printf "‘%s’" .Name) }}
{{ $term_count := (len .Pages) }}
<h1 class="p-name">{{ printf "Posts %s (%d)" $phrase $term_count }}</h1>
</header>
{{ range .Pages }}
<!-- If the current page's $term is "foo", it replaces «li class="__foo__"»
with «li class="active"».
The "__<taxo>__" are special classes added to the taxo buttons in the
taxo-buttons.html partial.
-->
{{ .Render "summary" | replaceRE (printf `(li class=")__%s__"` $term) `${1}active"` | safeHTML }}
{{ end }}
{{ partialCached "all-terms.html" . }}
</section>
{{ end }}
Is this a new issue from Hugo?
I have never seen this before. I am guessing the recent change caused this. In the stack trace, the first trace is from page.go, and then site.go. Does it mean that the error originated from page.go? And I believe the recent changes heavily touched those 2 files?
OK, I just confirmed that this issue was on Hugo v0.44 too. I cannot reproduce this on v0.43 as my theme doesn't support that or older versions.. getting "Error: media type keys cannot contain any '+' chars. Valid example is "text/css"".
Update: See below, this regression was introduced in hugo v0.42.
@bep syncing up all theme components so that they work with a particular older hugo version is difficult. But I can narrow down the range of hugo versions that introduced this regression. I last modified my shortcodes on May 30. So this breakage probably happened in releases after that. So this issue could have been introduced in v0.42, v0.43 or v0.44.
I confirm this regression to have been introduced in v0.42.
OK, I finally confirm this regression to be introduced in v0.42.
git clone --recurse-submodules https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io.git scripter.co
cd scripter.co
git checkout builds-with-hugo-0-41
cd themes/refined
git checkout pre-theme-component-split
cd ../..
hugo server --buildDrafts --buildFuture --navigateToChanged -p 1313
# cd to that cloned scripter.co dir
echo " " >> themes/refined/layouts/shortcodes/figure.html
The stacktrace/panic starts happening in v0.43 onwards.
Change detected, rebuilding site
2018-07-18 10:19:09.185 -0400
Template changed "/home/kmodi/temp/scripter.co/themes/refined/layouts/shortcodes/figure.html": WRITE
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "posts/hugo-leaf-and-branch-bundles/index.md"
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "posts/org-contribution-flowchart/index.md"
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "posts/git-diff-minified-js-and-css/index.md"
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "posts/accessing-devdocs-from-emacs/index.md"
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "posts/convert-seconds-to-human-time/index.md"
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "posts/microformats2/index.md"
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "posts/narrowing-the-author-column-in-magit.md"
ERROR 2018/07/18 10:19:09 Failed to render "_default/taxonomy.html": programming error: no mainPageOutput for "notes/plantuml/index.md"
Total in 682 ms
ERROR 2018/07/18 10:19:09 Failed to rebuild site: logged 8 error(s)
I also narrowed down to the problematic line in the template:
{{ .Render "summary" | replaceRE (printf `(li class=")__%s__"` $term) `${1}active"` | safeHTML }}
The issue persists even if I replace:
{{ range .Pages }}
{{ .Render "summary" | replaceRE (printf `(li class=")__%s__"` $term) `${1}active"` | safeHTML }}
{{ end }}
with:
{{ range .Pages }}
{{ .Render "summary" }}
{{ end }}
Turns out that that "Failed to render .. programming error" error happens only for the posts where I am using the figure
shortcode that I modified.
So in summary, hugo server
fails on v0.42+ if one of the used shortcodes is modified.
From the commit message:
Fix potential server panic with drafts/future enabled
But I can recreate this issue even without draft/future: hugo server --navigateToChanged -p 1313
.
Though, let me update the build and report back.
I confirm the fix, thanks!
I have to reopen and apply a different fix for this. I didn't really understand the last one, and it had some side-effects ...
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.
Hello,
I am not sure which this panic issue crept in, but I can consistently reproduce it on the latest hugo built from https://github.com/gohugoio/hugo/commit/75acff5f20d0d41ffa1ae20402001c7a82f077cb.
Steps to reproduce
Panic
Below shows that:
hugo server
content/bits/plantuml-version.md
.themes/refined/layouts/shortcodes/figure.html
Probably useful information: I set
disableFastRender = true
in my site's config.toml.Full panic log