Error during generation of the website

Today I want to generate my website, but I get:

hugo
Start building sites …
hugo v0.91.2-1798BD3F windows/amd64 BuildDate=2021-12-23T15:33:34Z VendorInfo=gohugoio
WARN 2022/01/08 22:39:16 Page.Dir is deprecated and will be removed in a future release. Use .File.Dir
.File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}
panic: runtime error: slice bounds out of range [6:5]

goroutine 119 [running]:
github.com/gohugoio/hugo/hugolib.(*pageState).deleteResource(…)
/root/project/hugo/hugolib/page.go:554
github.com/gohugoio/hugo/hugolib.(*pageState).renderResources.func1()
/root/project/hugo/hugolib/page.go:546 +0x245
sync.(*Once).doSlow(0x4068e0, 0xc0012c6000)
/usr/local/go/src/sync/once.go:68 +0xd2
sync.(*Once).Do(…)
/usr/local/go/src/sync/once.go:59
github.com/gohugoio/hugo/hugolib.(*pageState).renderResources(0xc0000cb8c0)
/root/project/hugo/hugolib/page.go:514 +0x67
github.com/gohugoio/hugo/hugolib.pageRenderer(0x0, 0xc0000cb8c0, 0x0, 0x0, 0x0)
/root/project/hugo/hugolib/site_render.go:113 +0xe7
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
/root/project/hugo/hugolib/site_render.go:73 +0x112

The only difference is that I made some images smaller.

It would be helpful if you could share your project Repository.

Unfortunately this site is for internal use, so I can not share the complete repository. When I enter: hugo server, I get no errors. I will try to do some more investigation on the directory where the generation stops.

You might consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing. I often find that going through this process helps me to identify the root cause.

Got it!

After a lot of trial and error, it seems that a directory with the name: ‘aaaaa (1960-…)’, was the problem. I renamed the directory to: ‘aaaaa (1960-)’, and it generates the website now.
Looks like that ‘…’ is the problem!
Strange that with ‘hugo server’ all tests work fine and no errors occurred.