Repository: gohugoio/hugo

Issue #6156: 0.56.x can't compile already working site
Created: 2019-08-02T14:47:19Z
on a working website running hugo with any of the 0.56.x releases I get the following error

hugo
Building sites … panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xbf8922]
goroutine 15 [running]:
github.com/gohugoio/hugo/hugofs.(*fileInfoMeta).IsDir(0xc002104080, 0xc001c6f2d0)
:1 +0x32
github.com/spf13/afero.IsDir(0x1c43a80, 0xc0006eaa80, 0xc001c6f2d0, 0xc, 0x0, 0x0, 0x0)
/build/hugo/parts/hugo/go/pkg/mod/github.com/spf13/afero@v1.2.2/util.go:279 +0x85
github.com/spf13/afero.(*CopyOnWriteFs).Open(0xc0006f5280, 0xc001c6f2d0, 0xc, 0x186b0cb, 0x7, 0xc001b04db2, 0x4)
/build/hugo/parts/hugo/go/pkg/mod/github.com/spf13/afero@v1.2.2/copyOnWriteFs.go:232 +0xb6
github.com/gohugoio/hugo/hugofs.(*languageCompositeFs).Open(0xc0005d2660, 0xc001c6f2d0, 0xc, 0xc001c6f2d0, 0xc, 0x0, 0x0)
/build/hugo/parts/hugo/build/hugofs/language_composite_fs.go:43 +0x46
github.com/spf13/afero.(*BasePathFs).Open(0xc0006f53c0, 0xc001b04db2, 0x4, 0xc001adc8f0, 0x16070f0, 0x0, 0xbf892c)
/build/hugo/parts/hugo/go/pkg/mod/github.com/spf13/afero@v1.2.2/basepath.go:136 +0x173
github.com/gohugoio/hugo/hugofs.(*FilterFs).Open(0xc0006f53e0, 0xc001b04db2, 0x4, 0x8, 0xc001bac1a8, 0x1, 0x0)
/build/hugo/parts/hugo/build/hugofs/filter_fs.go:175 +0x4b
github.com/gohugoio/hugo/hugofs.(*Walkway).walk(0xc0004de2d0, 0xc001b04db2, 0x4, 0x1c37a00, 0xc001b14740, 0x0, 0x0, 0x0, 0x193eb20, 0x0, ...)
/build/hugo/parts/hugo/build/hugofs/walk.go:182 +0xc23
github.com/gohugoio/hugo/hugofs.(*Walkway).walk(0xc0004de2d0, 0x0, 0x0, 0x1c37a00, 0xc001a7f640, 0xc00135e400, 0x8e, 0x8e, 0x193eb20, 0xc0006f53e0, ...)
/build/hugo/parts/hugo/build/hugofs/walk.go:290 +0x770
github.com/gohugoio/hugo/hugofs.(*Walkway).Walk(0xc0004de2d0, 0xc0006f53e0, 0x0)
/build/hugo/parts/hugo/build/hugofs/walk.go:137 +0x1dd
github.com/gohugoio/hugo/hugolib.(*pagesCollector).collectDir(0xc001a38230, 0x0, 0x0, 0x1c2a500, 0x0, 0xc00195f440, 0xb)
/build/hugo/parts/hugo/build/hugolib/pages_capture.go:323 +0x38a
github.com/gohugoio/hugo/hugolib.(*pagesCollector).Collect(0xc001a38230, 0x0, 0x0)
/build/hugo/parts/hugo/build/hugolib/pages_capture.go:120 +0x473
github.com/gohugoio/hugo/hugolib.(*Site).readAndProcessContent(0xc000484e00, 0x0, 0x0, 0x0, 0x1941040, 0xc0001fdc54)
/build/hugo/parts/hugo/build/hugolib/site.go:1317 +0x189
github.com/gohugoio/hugo/hugolib.(*Site).process(0xc000484e00, 0x0, 0x0, 0x0, 0x0, 0xc001a86620, 0x0, 0x0, 0xd67116, 0xc0001fdb88)
/build/hugo/parts/hugo/build/hugolib/site.go:1085 +0x62
github.com/gohugoio/hugo/hugolib.(*HugoSites).process(0xc0006e0300, 0xc001a7de00, 0x0, 0x0, 0x0, 0xc00007dc60, 0x20)
/build/hugo/parts/hugo/build/hugolib/hugo_sites_build.go:223 +0x197
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func2.1()
/build/hugo/parts/hugo/build/hugolib/hugo_sites_build.go:96 +0x57
runtime/trace.WithRegion(0x1c2a5e0, 0xc001a8d6b0, 0x186c6ea, 0x7, 0xc00007dd38)
/snap/go/4098/src/runtime/trace/annotation.go:137 +0xe9
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func2(0xc0008095b8, 0x20)
/build/hugo/parts/hugo/build/hugolib/hugo_sites_build.go:98 +0x1b0
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func3()
/build/hugo/parts/hugo/build/hugolib/hugo_sites_build.go:115 +0x2f
runtime/trace.WithRegion(0x1c2a5e0, 0xc001a8d6b0, 0x186c688, 0x7, 0xc0008096c8)
/snap/go/4098/src/runtime/trace/annotation.go:137 +0xe9
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0xc0006e0300, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/build/hugo/parts/hugo/build/hugolib/hugo_sites_build.go:117 +0x7d9
github.com/gohugoio/hugo/commands.(*commandeer).buildSites(...)
/build/hugo/parts/hugo/build/commands/hugo.go:707
github.com/gohugoio/hugo/commands.(*commandeer).fullBuild.func3(0x8, 0x1941060)
/build/hugo/parts/hugo/build/commands/hugo.go:318 +0x79
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc001a8d650, 0xc001a865f0)
/build/hugo/parts/hugo/go/pkg/mod/golang.org/x/sync@v0.0.0-20190423024810-112230192c58/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
/build/hugo/parts/hugo/go/pkg/mod/golang.org/x/sync@v0.0.0-20190423024810-112230192c58/errgroup/errgroup.go:54 +0x66

Downgrading to 0.55.6 makes hugo command work again
I have seen this happening on ubuntu 16.04 and 18.04 2 different systems

Duplicate issue #6449: Hugo Server issue with multilingual mode versions > 0.55.6
Created: 2019-10-23T13:28:45Z
What version of Hugo are you using (hugo version)?
0.55.6, and tested with later versions. 


Does this issue reproduce with the latest release?
Yes.
Hi All,
I am having an issue with a large hugo site of mine. It has many content files and over 5 languages. I am currently using Hugo version 0.55.6. My goal is to upgrade hugo to the latest version 0.59.0. However, when upgrading to any version greater than 0.55.6 and running the hugo server command, I get this issue:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4550bee]
goroutine 1818 [running]:
github.com/gohugoio/hugo/hugofs.(*fileInfoMeta).IsDir(0xc00d054a80, 0xc0007480a0)
        <autogenerated>:1 +0x2e
github.com/gohugoio/hugo/hugofs.(*FilterFs).LstatIfPossible(0xc0007480c0, 0xc024d4cb27, 0x4, 0x400e4fc, 0xfded8f0, 0x13f, 0xc0007e39e0, 0x54d92a0)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugofs/filter_fs.go:152 +0x92
github.com/gohugoio/hugo/hugofs.(*FilterFs).Stat(0xc0007480c0, 0xc024d4cb27, 0x4, 0xc00cf6a250, 0x1, 0x203003, 0x203003)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugofs/filter_fs.go:208 +0x3f
github.com/gohugoio/hugo/hugolib.(*pagesCollector).collectDir(0xc028ce8ff0, 0xc024d4cb27, 0x4, 0xc01a55ec01, 0x0, 0xc024d4cb27, 0x4)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/pages_capture.go:151 +0x66
github.com/gohugoio/hugo/hugolib.(*pagesCollector).Collect(0xc028ce8ff0, 0xc028ce8ff0, 0xc0007480c0)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/pages_capture.go:126 +0x2de
github.com/gohugoio/hugo/hugolib.(*Site).readAndProcessContent(0xc0004c1880, 0xc019f8f1e0, 0x1, 0x1, 0x1, 0x1)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/site.go:1249 +0x187
github.com/gohugoio/hugo/hugolib.(*Site).processPartial(0xc0004c1880, 0xc02ecbc0c0, 0xc01a55f6c8, 0xc008f6aa80, 0x1, 0x1, 0xc01f0a44f8, 0x18)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/site.go:1050 +0xdca
github.com/gohugoio/hugo/hugolib.(*HugoSites).process(0xc000708780, 0xc02ecbc0c0, 0xc01a55f6c8, 0xc008f6a940, 0x1, 0x1, 0x40303ea, 0x406f701)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:225 +0x99
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func2.2()
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:103 +0x64
runtime/trace.WithRegion(0x5a8b180, 0xc027317530, 0x56f8dd5, 0x7, 0xc01a55f6f0)
        /usr/local/Cellar/go/1.13.3/libexec/src/runtime/trace/annotation.go:137 +0x115
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func2(0x40303ea, 0x1)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:105 +0x162
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func3()
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:122 +0x2f
runtime/trace.WithRegion(0x5a8b180, 0xc027317530, 0x56f8d73, 0x7, 0xc01a55f920)
        /usr/local/Cellar/go/1.13.3/libexec/src/runtime/trace/annotation.go:137 +0x115
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0xc000708780, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc027317500, 0xc008f6a940, 0x1, ...)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:124 +0x80b
github.com/gohugoio/hugo/commands.(*commandeer).rebuildSites(0xc0006b5110, 0xc008f6a940, 0x1, 0x1, 0x0, 0x0)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/commands/hugo.go:738 +0x3e8
github.com/gohugoio/hugo/commands.(*commandeer).handleEvents(0xc0006b5110, 0xc026e97f80, 0xc024bce060, 0xc01f0a44e0, 0x2, 0x2, 0xc01545ee70)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/commands/hugo.go:1095 +0x710
github.com/gohugoio/hugo/commands.(*commandeer).newWatcher.func1(0xc026e97f80, 0xc0006b5110, 0xc024bce060, 0xc01545ee70)
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/commands/hugo.go:842 +0x1d8
created by github.com/gohugoio/hugo/commands.(*commandeer).newWatcher
        /private/tmp/hugo-20191021-17314-9w2g7c/hugo-0.59.0/src/github.com/gohugoio/hugo/commands/hugo.go:838 +0x293


To test this error on smaller scale, I created a new hugo site with the quickstart guide. The repo is here: https://github.com/zbayoff/quickstart
I tested with 3 different language directories: en, fr, and es. I created a test post in 2 of these directories and tested with both version 0.55.6 and greater. The reason I'm not adding the post to all of the directories is because that's how it is in my larger hugo site. Not all the content has been translated so only the en blog posts and some of the es posts exist.
The site builds and reloads fine with version 0.55.6, but greater than this version, and I get the error above.
I found this issue https://discourse.gohugo.io/t/runtime-error-invalid-memory-address-or-nil-pointer-dereference-while-running-the-server/20143/2
where someone experienced a similar problem, if an md file is not present in all of the language directories, then hugo server will throw an error.
Please see the test repo above to recreate the issue. Try hugo version 0.55.6, there should be no error. Try hugo version greater than 0.55.6, there should be an error. Then copy the test blog post to content/es, the error should go away.
Any help would be appreciated.
Thank you.

Closing comment (2019-10-28T11:55:57Z): looks like a duplicate of #6156 to me