See https://github.com/gohugoio/hugo/issues/13810 This is a known issue, I guess the the fix is to recover and print the stack trace, then return an error.