{"record":{"id":"d0ff64db6fcbb1bf","repo":"gohugoio/hugo","slug":"failed-to-load-codeowners-w","errorCode":null,"errorMessage":"failed to load CODEOWNERS: %w","messagePattern":"failed to load CODEOWNERS: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page__new.go","lineNumber":95,"sourceCode":"\t\t},\n\t}\n\n\tif ps.IsHome() && ps.PathInfo().IsLeafBundle() {\n\t\tmsg := \"Using %s in your content's root directory is usually incorrect for your home page. \"\n\t\tmsg += \"You should use %s instead. If you don't rename this file, your home page will be \"\n\t\tmsg += \"treated as a leaf bundle, meaning it won't be able to have any child pages or sections.\"\n\t\tps.s.Log.Warnidf(constants.WarnHomePageIsLeafBundle, msg, ps.PathInfo().PathNoLeadingSlash(), strings.ReplaceAll(ps.PathInfo().PathNoLeadingSlash(), \"index\", \"_index\"))\n\t}\n\n\tif m.f != nil {\n\t\tgi, err := s.h.gitInfoForPage(ps)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load Git data: %w\", err)\n\t\t}\n\t\tps.gitInfo = gi\n\t\towners, err := s.h.codeownersForPage(ps)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load CODEOWNERS: %w\", err)\n\t\t}\n\t\tps.codeowners = owners\n\t}\n\n\tps.pageMenus = &pageMenus{p: ps}\n\tps.PageMenusProvider = ps.pageMenus\n\tps.GetPageProvider = pageSiteAdapter{s: s, p: ps}\n\tps.GitInfoProvider = ps\n\tps.TranslationsProvider = ps\n\tps.ResourceDataProvider = newDataFunc(ps)\n\tps.RawContentProvider = ps\n\tps.ChildCareProvider = ps\n\tps.TreeProvider = pageTree{p: ps}\n\tps.Eqer = ps\n\tps.TranslationKeyProvider = ps\n\tps.ShortcodeInfoProvider = ps\n\tps.AlternativeOutputFormatsProvider = ps\n","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page__new.go#L77-L113","documentation":"Raised at page__new.go:95 when HugoSites.codeownersForPage cannot resolve CODEOWNERS data for a page. codeownersForPage triggers the same one-shot gitInfo init that loadGitInfo (hugo_sites.go:546) runs; newCodeOwners (codeowners.go:54) finds and parses the CODEOWNERS file. The wrapped error is the parse/IO failure.","triggerScenarios":"enableGitInfo = true is set and a CODEOWNERS file exists but is malformed (bad pattern, unparseable line); the CODEOWNERS file cannot be read due to permissions; the codeowners library rejects a rule syntax it does not support.","commonSituations":"Adopting CODEOWNERS in a Hugo project with a hand-edited file that contains a syntax the parser rejects; a CODEOWNERS inherited from GitHub with a feature Hugo's parser does not support; file permission issues in containerized builds.","solutions":["Open the CODEOWNERS file and fix the offending line flagged by the wrapped error (commonly a malformed glob or missing owner).","If CODEOWNERS metadata is not needed, set `enableGitInfo = false` or remove/rename the CODEOWNERS file so it is not picked up.","Validate the file against GitHub's CODEOWNERS syntax and simplify any advanced patterns."],"exampleFix":"# before (CODEOWNERS with bad line)\n/src/ @team-a not-an-owner\n\n# after\n/src/ @team-a @team-b","handlingStrategy":"validation","validationCode":"# If you ship a CODEOWNERS file, lint it as part of CI.\n# A minimal check: every non-comment line must end with at least one owner token.\nawk 'NF && $1 !~ /^#/ && NF < 2 {print FILENAME \":\" NR \": missing owner\"; exit 1}' CODEOWNERS","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep CODEOWNERS syntax simple (path-pattern followed by @user/@team tokens).","If CODEOWNERS is not needed, do not enable enableGitInfo or remove the file.","Add a CI lint step for CODEOWNERS to catch malformed rules before Hugo runs."],"tags":["codeowners","git","configuration","metadata"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}