Panic: runtime error

I open this issue here as told by @jmooring on GitHub.

Hugo Static Site Generator v0.72.0/extended windows/amd64 BuildDate: unknown

Does this issue reproduce with the latest release?


Since many versions (sorry I did not keep track), I have this error “randomly” popping (in all my Hugo projects I think), when sometimes I do not change anything (it happens in the watcher apparently), but usually when I change a file. Then the process stops, I launch back hugo and the error is not here any more. I would say it happens around every half an hour or so, to give an idea. For example it happens in this repo.


panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xfd042d]     

goroutine 251 [running]:*pageMaps).withMaps(0x0, 0xc003cb0240, 0x3, 0xc0035ad4f7)
        /root/project/hugo/hugolib/content_map_page.go:781 +0x2d*HugoSites).removePageByFilename(0xc005e8c6e0, 0xc0035ad490, 0x6a)        
        /root/project/hugo/hugolib/hugo_sites.go:709 +0x75*Site).processPartial(0xc0042658c0, 0xc003caa640, 0xc001a71740, 0xc003cb0120, 0x1, 0x1, 0x0, 0x0)
        /root/project/hugo/hugolib/site.go:1085 +0xa10*HugoSites).process(0xc005e8c6e0, 0xc003caa640, 0xc001a71740, 0xc0038bb5a0, 0x1, 0x1, 0x315ffd8, 0x30001)
        /root/project/hugo/hugolib/hugo_sites_build.go:244 +0xa0*HugoSites).Build.func2.2()
        /root/project/hugo/hugolib/hugo_sites_build.go:118 +0x6b
runtime/trace.WithRegion(0x2429c20, 0xc003ca9980, 0x1e8c153, 0x7, 0xc001a71768)
        /usr/local/go/src/runtime/trace/annotation.go:137 +0x105*HugoSites).Build.func2(0x315ffd8, 0xc003c91501)
        /root/project/hugo/hugolib/hugo_sites_build.go:120 +0x169*HugoSites).Build.func3()
        /root/project/hugo/hugolib/hugo_sites_build.go:137 +0x36
runtime/trace.WithRegion(0x2429c20, 0xc003ca9980, 0x1e8c0e3, 0x7, 0xc001a71910)
        /usr/local/go/src/runtime/trace/annotation.go:137 +0x105*HugoSites).Build(0xc005e8c6e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0038c0150, 0x0, 0xc0038bb5a0, ...)
        /root/project/hugo/hugolib/hugo_sites_build.go:139 +0x966*commandeer).rebuildSites(0xc0007f9860, 0xc0038bb5a0, 0x1, 0x1, 0x0, 0x0)
        /root/project/hugo/commands/hugo.go:734 +0x40e*commandeer).handleEvents(0xc0007f9860, 0xc002d0cb00, 0xc0024b85f8, 0xc002d70260, 0x1, 0x1, 0xc0022dc690)
        /root/project/hugo/commands/hugo.go:1099 +0x76b*commandeer).newWatcher.func1(0xc002d0cb00, 0xc0007f9860, 0xc0024b85f8, 0xc0022dc690)
        /root/project/hugo/commands/hugo.go:841 +0x1df
created by*commandeer).newWatcher
        /root/project/hugo/commands/hugo.go:837 +0x294

So, it’s obviously a bug, not sure why/how.

Did the error ever come up when running hugo instead of hugo server? I’ll have a look at your repo tomorrow (if nobody finds an obvious solution). The only reason why this would come up on my repos were loops in my templates that did not break properly (partial called itself which called itself which called itself… ad eternum).

@pkollitsch, I left hugo server running against this site for a couple of hours, with occasional changes to content to force rebuilds, and I could not reproduce the problem. My system is either too fast or too slow, or perhaps just right.

See, committed this morning.

1 Like

I cannot have a look at all CI run logs (production builds) as the oldest ones have expired, but as for the ones that are still available there not seems to be failed hugo builds. And for the hugo builds that I run manually/locally, I haven’t seen this error come up. It seems to happen only with server.

I’m pretty sure this should be fixed in

1 Like

Thanks, I’ll check when it’s released

So there still are some

Change detected, rebuilding site.
Source changed "XXX": WRITE

for files I haven’t changed, but no error any more in 2 hours of dev with last version!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.