Invalid memory address or nil pointer dereference

Tonight as I was making changes to my web site I started getting the following error messages:
"hugo server
Start building sites …
hugo v0.114.1-e9b716ad9869b79e7c374bbdae4daf5ee6406bd4+extended linux/amd64 BuildDate=2023-06-23T11:02:58Z VendorInfo=gohugoio

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1ca3e71]

goroutine 11 [running]:
github.com/gohugoio/hugo/hugolib.(*pageState).getLayoutDescriptor.func1()
/root/project/hugo/hugolib/page.go:448 +0xf1
sync.(*Once).doSlow(0x0?, 0x0?)
/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(…)
/usr/local/go/src/sync/once.go:65
github.com/gohugoio/hugo/hugolib.(*pageState).getLayoutDescriptor(0xc0002995f0?)
/root/project/hugo/hugolib/page.go:437 +0x76
github.com/gohugoio/hugo/hugolib.(*pageState).resolveTemplate(0xc0002995f0, {0x0, 0x0, 0xc00029af85?})
/root/project/hugo/hugolib/page.go:475 +0x1ce
github.com/gohugoio/hugo/hugolib.pageRenderer(0x0?, 0xc0007bab00, 0xc00015efd0?, 0x8f0eaa?, 0x0?)
/root/project/hugo/hugolib/site_render.go:128 +0x10f
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
/root/project/hugo/hugolib/site_render.go:76 +0x108"
These errors do not specify where my code is generating the errors, they are all at strongithub.com/gohugoio/hugo/hugolibg text

Any ideas how I can fix this error? I was trying to add tags to my code and when the errors started I tried to remove all of the tag code I had inserted. but, no matter what I did the errors kept coming.
Thanks.

This looks like a bug in Hugo (it should not panic like this), but I have not seen this before, which means that I cannot determine what causes it without seeing the failing site source.

I had upgraded Hugo a few days ago and it was working fine until yesterday all of a sudden the errors showed up while I was making changes to my code.
Thanks for the quick response.

My code is in a private repository on Github. How can I let you see the code?

On my laptop I have a dual boot with Ubuntu and Linux Mint. I was using Ubuntu when the error occurred so tonight I switched to Linux Mint and installed Hugo 0.114.1 and also the latest version of GO. When I did “hugo server” I got the same errors. I thought I might have just updated Ubuntu and that was causing the problem but I guess not as it happened in Linux Mint too.

Edit: I just downloaded and installed Hugo 0.115.0 and the error is still there. It is like some people say: “People that live on the cutting edge are likely to bleed.”

I just tried some of my OLD projects and they ran fine with Hugo 115 so it looks like the problem is in my NEW project. But the errors are showing in the Hugo code and NOT in my code. I will try loading some of my old/new code from Github and will let you know the results.

Thanks to GitHub I was able to find when the error occurred so I copied the repro to the time before the error so I am back in business again. Now I have to make the changes I need and hope the error does not come back again.

When I downloaded the files from Github I ran a program called “Meld”. It found some places where I had spelled author and other places I spelled it auther but don’t think that should have caused the error.

Any way after downloading and comparing the files I am back in business.

Another thought I had was that I renamed a file with an extension of “.old”. When I tried that again it didn’t create the errors so I am at a loss to explain where the errors came from.

There used to be a radio show called “The Shadow” and every episode started with “Who knows what evil lies in the heart of the computer? The Shadow knows”

Thanks for looking at the problem and I hope I can continue now without any more problems.