The following bash script is the simplest cause of the panic I have been able to reproduce in a new hugo site, but I have also seen this panic running in production when automated processes create a number of files together.
adding created directory to watchlist <dir>/content/nesteddir
adding created directory to watchlist <dir>/content/nesteddir/dir1
adding created directory to watchlist <dir>/content/dir1
adding created directory to watchlist <dir>/content/dir2
Change detected, rebuilding site (#1).
2026-02-27 00:03:58.983 +0000
Source changed /nesteddir/dir1/post.md
Source changed /dir1
Source changed /dir2
Source changed /nesteddir
Total in 1 ms
panic: runtime error: index out of range [1] with length 1
goroutine 29 [running]:
github.com/gohugoio/hugo/hugolib.(*HugoSites).fileEventsContentPaths(0x7a77afe88bb0?, {0x7a77aff8ad80?, 0x14?, 0xa?})
github.com/gohugoio/hugo/hugolib/site.go:1323 +0xa10
github.com/gohugoio/hugo/hugolib.(*HugoSites).processPartialFileEvents(0x7a77afc0a908, {0x1052e6ce0, 0x105b626e0}, {0x1052fb090, 0x7a77af831d40}, 0x7a77aff8ac40, 0x7a77af45d5a8, {0x7a77afb74000, 0x4, 0x4})
github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:1162 +0x17bc
github.com/gohugoio/hugo/hugolib.(*HugoSites).process(0x7a77afc0a908, {0x1052e6ce0, 0x105b626e0}, {0x1052fb090?, 0x7a77af831d40?}, 0x7a77aff8ac40, 0x7a77af45d5a8, {0x7a77afb74000, 0x4, 0x4})
github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:288 +0x1ac
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build.func6(...)
github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:170
github.com/gohugoio/hugo/hugolib.(*HugoSites).Build(0x7a77afc0a908, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0}, {0x7a77afb74000, ...})
github.com/gohugoio/hugo/hugolib/hugo_sites_build.go:186 +0x5f8
github.com/gohugoio/hugo/commands.(*hugoBuilder).rebuildSites(0x7a77afc33580, {0x7a77afb74000, 0x4, 0x4})
github.com/gohugoio/hugo/commands/hugobuilder.go:1159 +0x134
github.com/gohugoio/hugo/commands.(*hugoBuilder).handleEvents.func7(0x7a77afc33580, 0x7a77aff0faa0)
github.com/gohugoio/hugo/commands/hugobuilder.go:948 +0x70
github.com/gohugoio/hugo/commands.(*hugoBuilder).handleEvents(0x7a77afc33580, 0x7a77b00d9290, 0x7a77afe421b8, {0x7a77afd08820, 0x3, 0x4}, 0x7a77b00d9320)
github.com/gohugoio/hugo/commands/hugobuilder.go:951 +0x14ec
github.com/gohugoio/hugo/commands.(*hugoBuilder).newWatcher.func2()
github.com/gohugoio/hugo/commands/hugobuilder.go:392 +0x1bc
created by github.com/gohugoio/hugo/commands.(*hugoBuilder).newWatcher in goroutine 1
github.com/gohugoio/hugo/commands/hugobuilder.go:363 +0x3e8
What version of Hugo are you using (
hugo version)?Does this issue reproduce with the latest release?
Yes
Steps to reproduce
The following bash script is the simplest cause of the panic I have been able to reproduce in a new hugo site, but I have also seen this panic running in production when automated processes create a number of files together.
To reproduce:
hugo build -w./create-content.shAfter this, if
hugo build -wis re-run, the site builds correctly, including the new pages.Panic Output