Hugo

Stray IsSet error since 0.57(.1)

Since a day or two I have a strange error message coming up when running hugo server.

WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.

When running without debugging it’s the first line, when running with debugging it’s located between the piping and the menu creation.

I did not find ANY IsSet in my templates or themes or any of the installed npm packages. What would be a start to debug this issue?

19:39:03][patrick@skadi] ~/Projects/Me/davids-neighbour.com (+1|%0|!422|0)
❯ hugo server --debug
DEBUG 2019/08/16 19:39:06 Add template file: name "404.html", baseTemplatePath "_default/baseof.html", path "404.html"
...
DEBUG 2019/08/16 19:39:06 Add template file: name "static/search.html", baseTemplatePath "_default/baseof.html", path "static/search.html"
INFO 2019/08/16 19:39:06 Using config file: 
Building sites … INFO 2019/08/16 19:39:06 syncing static files to /
INFO 2019/08/16 19:39:06 postcss: use config file /home/patrick/Projects/Me/davids-neighbour.com/postcss.config.js
WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.

DEBUG 2019/08/16 19:39:10 found menu: "main", in site config
...
DEBUG 2019/08/16 19:39:10 creating alias: /posts/page/1/index.html redirecting to http://localhost:1313/posts/
DEBUG 2019/08/16 19:39:10 creating alias: /tags/page/1/index.html redirecting to http://localhost:1313/tags/
DEBUG 2019/08/16 19:39:10 Render XML for "sitemap" to "/sitemap.xml"

                   | EN   
+------------------+-----+
  Pages            |  28  
  Paginator pages  |   0  
  Non-page files   |   0  
  Static files     | 379  
  Processed images |   0  
  Aliases          |   2  
  Sitemaps         |   1  
  Cleaned          |   0  

Total in 3586 ms
Watching for changes in /home/patrick/Projects/Me/davids-neighbour.com/{archetypes,assets,content,i18n,layouts,static,themes}
Watching for config changes in /home/patrick/Projects/Me/davids-neighbour.com/config.toml, /home/patrick/Projects/Me/davids-neighbour.com/themes/dnb-hugo-netlification/config.toml, /home/patrick/Projects/Me/davids-neighbour.com/themes/dnb-hugo-shortcodes/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Double checking, running this from your site root returns nothing?

grep -i -r 'isset' *

That returns quite a lot in node_modules and some in my layout files. Not IsSet though, just isset… I’ll try to find out what’s going on here.

I would start there

Weird. I had this codeblock in the header:

{{ if and (isset .Site.Params "authors") (isset .Params "author") }}
	<!-- Article Specific Open Graph Markup -->
	{{ $author := index .Site.Params.authors .Params.author }}
	<meta property="article:author" content="https://www.facebook.com/{{ $author.social.facebook }}" />
{{ end }}

and changed it into

{{ if or (isset .Site.Params "authors") (isset .Params "author") }}
	<!-- Article Specific Open Graph Markup -->
	{{ $author := index .Site.Params.authors .Params.author }}
	<meta property="article:author" content="https://www.facebook.com/{{ $author.social.facebook }}" />
{{ end }}

and the error disappeared. somehow both blocks don’t make much sense to me.

It looks like the first block tries to have my frontmatter add an author name that would have been somewhere as an index in the global configuration.

Probably a case of blind copy&paste. I think I solved this different on other sites and willl just remove it.

Thanks for your help. I did not start to think about using all lowercase to look for the issue. If I would understand more of Golang I would try to make Hugo’s error/warnings more verbose… time to learn a new language :smiley: