Panic: interface conversion: *hugolib.pageState is not resource.NameNormalizedProvider: missing method NameNormalized

Hello everyone,

I’m currently getting this error in my project and there are basically no search results except one rather odd forum post.

This is the error message:

hugo v0.131.0-bfbee17932ff24009008aa94cdd75c0c41f59279+extended linux/amd64 BuildDate=2024-08-02T09:03:48Z VendorInfo=snap:0.131.0

panic: interface conversion: *hugolib.pageState is not resource.NameNormalizedProvider: missing method NameNormalized

goroutine 74 [running]:
github.com/gohugoio/hugo/hugolib.(*pageMap).getOrCreateResourcesForPage.func1({0xc0002a1888?, 0x42efb80?})
/build/hugo/parts/hugo/build/hugolib/content_map_page.go:563 +0x545
github.com/bep/lazycache.(*Cache[...]).GetOrCreate(0x42e4300, {0xc001384740, 0x1d}, 0xc000aa8ab0)
/build/hugo/parts/hugo/go/pkg/mod/github.com/bep/lazycache@v0.4.0/lazycache.go:125 +0x17a
github.com/gohugoio/hugo/cache/dynacache.(*Partition[...]).doGetOrCreate(...)
/build/hugo/parts/hugo/build/cache/dynacache/dynacache.go:410
github.com/gohugoio/hugo/cache/dynacache.(*Partition[...]).GetOrCreate(0x42e98a0, {0xc001384740, 0x1d}, 0xc000ecdab0)
/build/hugo/parts/hugo/build/cache/dynacache/dynacache.go:398 +0x46
github.com/gohugoio/hugo/hugolib.(*pageMap).getOrCreateResourcesForPage(0xc000af2dc0, 0xc0007ab110)
/build/hugo/parts/hugo/build/hugolib/content_map_page.go:539 +0xb5
github.com/gohugoio/hugo/hugolib.(*pageState).Resources(...)
/build/hugo/parts/hugo/build/hugolib/page.go:347
github.com/gohugoio/hugo/hugolib.(*pageState).renderResources.func1()
/build/hugo/parts/hugo/build/hugolib/page.go:506 +0x3f
sync.(*Once).doSlow(0x0?, 0xc00100c018?)
/build/hugo/stage/src/sync/once.go:74 +0xc2
sync.(*Once).Do(…)
/build/hugo/stage/src/sync/once.go:65
github.com/gohugoio/hugo/hugolib.(*pageState).renderResources(0x0?)
/build/hugo/parts/hugo/build/hugolib/page.go:505 +0x55
github.com/gohugoio/hugo/hugolib.pageRenderer(0xc001283b00, 0xc00026af00, 0xc0011163c0, 0xc000f017a0, 0xc000d5cf00?)
/build/hugo/parts/hugo/build/hugolib/site_render.go:134 +0x233
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages in goroutine 10
/build/hugo/parts/hugo/build/hugolib/site_render.go:80 +0x10a

I know that I’m one version behind the current release, but I’ve had this error before the last update to my current version (v0.131.0).

I think, the error can be reproduced by simply creating new content in de/* or en/* via the CLI.
After that, I’m getting the error message.

The only forum post which I could find was this one: I got an error as of v125 but not in v120

What does the error mean and how can I fix it?

The last guy wasn’t able or willing to share a reproducible example.

Can you?

As I’ve written:
I think, the error can be reproduced by simply creating new content in de/* or en/* via the CLI.
After that, I’m getting the error message.

So, steps to reproduce the error:

Clone repository:
git clone git@bitbucket.org:webdev-hq/tobias-hopp.de.git

Create new content via CLI with:
hugo new content/de/about/whatever.md

Start hugo server with: hugo server -D

Results in:

Panic: interface conversion: *hugolib.pageState is not resource.NameNormalizedProvider: missing method NameNormalized

In case you need more information to reproduce the error, please let me know.
Thanks.

Thank you. This is helpful. The panic occurs with v0.123.4 and later, and seems to be triggered (at least in part) by the translationKey field in front matter.

In your example, you don’t need to set translationKey in front matter; you’re using the same file path for each language.

I’ll narrow this down a bit more and log a bug at some point.

See https://github.com/gohugoio/hugo/issues/12795.

1 Like

Thanks a lot for having a look at this.

I’m assuming you were able to reproduce it properly, cool.

I’ll also try the fix you’ve suggested. Thank you.

1 Like

This was resolved in v0.133.1.

1 Like

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