# Panic: runtime error

**URL:** <https://discourse.gohugo.io/t/panic-runtime-error/26295>\
**Category:** support\
**Created:** [June 16, 2020, 7:59am UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295 "2020-06-16T07:59:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![inwardmovement](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inwardmovement/32/5396_2.png) [@inwardmovement](https://discourse.gohugo.io/u/inwardmovement)\
**Post date:** [June 16, 2020, 7:59am UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/1 "2020-06-16T07:59:30Z")

</div>

I open this issue here as told by @jmooring [on GitHub](https://github.com/gohugoio/hugo/issues/7375).

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

### Does this issue reproduce with the latest release?

Yes

* * *

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](https://github.com/algosphere/algo-website).

log:

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

goroutine 251 [running]:
github.com/gohugoio/hugo/hugolib.(*pageMaps).withMaps(0x0, 0xc003cb0240, 0x3, 0xc0035ad4f7)
        /root/project/hugo/hugolib/content_map_page.go:781 +0x2d
github.com/gohugoio/hugo/hugolib.(*HugoSites).removePageByFilename(0xc005e8c6e0, 0xc0035ad490, 0x6a)        
        /root/project/hugo/hugolib/hugo_sites.go:709 +0x75
github.com/gohugoio/hugo/hugolib.(*Site).processPartial(0xc0042658c0, 0xc003caa640, 0xc001a71740, 0xc003cb0120, 0x1, 0x1, 0x0, 0x0)
        /root/project/hugo/hugolib/site.go:1085 +0xa10
github.com/gohugoio/hugo/hugolib.(*HugoSites).process(0xc005e8c6e0, 0xc003caa640, 0xc001a71740, 0xc0038bb5a0, 0x1, 0x1, 0x315ffd8, 0x30001)
        /root/project/hugo/hugolib/hugo_sites_build.go:244 +0xa0
github.com/gohugoio/hugo/hugolib.(*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
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func2(0x315ffd8, 0xc003c91501)
        /root/project/hugo/hugolib/hugo_sites_build.go:120 +0x169
github.com/gohugoio/hugo/hugolib.(*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
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0xc005e8c6e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0038c0150, 0x0, 0xc0038bb5a0, ...)
        /root/project/hugo/hugolib/hugo_sites_build.go:139 +0x966
github.com/gohugoio/hugo/commands.(*commandeer).rebuildSites(0xc0007f9860, 0xc0038bb5a0, 0x1, 0x1, 0x0, 0x0)
        /root/project/hugo/commands/hugo.go:734 +0x40e
github.com/gohugoio/hugo/commands.(*commandeer).handleEvents(0xc0007f9860, 0xc002d0cb00, 0xc0024b85f8, 0xc002d70260, 0x1, 0x1, 0xc0022dc690)
        /root/project/hugo/commands/hugo.go:1099 +0x76b
github.com/gohugoio/hugo/commands.(*commandeer).newWatcher.func1(0xc002d0cb00, 0xc0007f9860, 0xc0024b85f8, 0xc0022dc690)
        /root/project/hugo/commands/hugo.go:841 +0x1df
created by github.com/gohugoio/hugo/commands.(*commandeer).newWatcher
        /root/project/hugo/commands/hugo.go:837 +0x294

```

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 16, 2020, 8:16am UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/2 "2020-06-16T08:16:50Z")

</div>

> [@inwardmovement](#):
>
> `nil pointer`

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

> <https://github.com/gohugoio/hugo/issues/7392>
>
> https://discourse.gohugo.io/t/panic-runtime-error/26295
> 
> \`\`\`
> goroutine 251 \[r…unning\]:
> github.com/gohugoio/hugo/hugolib.(\*pageMaps).withMaps(0x0, 0xc003cb0240, 0x3, 0xc0035ad4f7)
> /root/project/hugo/hugolib/content\_map\_page.go:781 +0x2d
> github.com/gohugoio/hugo/hugolib.(\*HugoSites).removePageByFilename(0xc005e8c6e0, 0xc0035ad490, 0x6a)        
> /root/project/hugo/hugolib/hugo\_sites.go:709 +0x75
> \`\`\`

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [June 16, 2020, 3:12pm UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/3 "2020-06-16T15:12:31Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [June 16, 2020, 3:19pm UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/4 "2020-06-16T15:19:49Z")

</div>

@[pkollitsch](https://discourse.gohugo.io/u/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 [https://github.com/gohugoio/hugo/pull/7393](https://github.com/gohugoio/hugo/pull/7393), committed this morning.

---

<div class="post-metadata">

**Author:** ![inwardmovement](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inwardmovement/32/5396_2.png) [@inwardmovement](https://discourse.gohugo.io/u/inwardmovement)\
**Post date:** [June 16, 2020, 4:17pm UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/5 "2020-06-16T16:17:11Z")

</div>

I cannot have a look at all [CI run logs](https://github.com/algosphere/algo-website/actions) (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`.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [June 16, 2020, 8:14pm UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/6 "2020-06-16T20:14:33Z")

</div>

I’m pretty sure this should be fixed in

> <https://github.com/gohugoio/hugo/commit/6408c1cbc87f03fc9e92471165886ddbe7cdbeae>

---

<div class="post-metadata">

**Author:** ![inwardmovement](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inwardmovement/32/5396_2.png) [@inwardmovement](https://discourse.gohugo.io/u/inwardmovement)\
**Post date:** [June 17, 2020, 6:07am UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/7 "2020-06-17T06:07:26Z")

</div>

Thanks, I’ll check when it’s released

---

<div class="post-metadata">

**Author:** ![inwardmovement](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/inwardmovement/32/5396_2.png) [@inwardmovement](https://discourse.gohugo.io/u/inwardmovement)\
**Post date:** [July 4, 2020, 10:20am UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/8 "2020-07-04T10:20:57Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [July 6, 2020, 10:21am UTC](https://discourse.gohugo.io/t/panic-runtime-error/26295/9 "2020-07-06T10:21:07Z")

</div>

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