{"record":{"id":"8f33fdca3a23550a","repo":"gohugoio/hugo","slug":"failed-to-create-page-meta-from-file-q-w","errorCode":null,"errorMessage":"failed to create page meta from file %q: %w","messagePattern":"failed to create page meta from file %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/content_map.go","lineNumber":313,"sourceCode":"\t\tpageSourceCount += pc\n\t\tresourceSourceCount += rc\n\t\tif err != nil {\n\t\t\taddErr = err\n\t\t\treturn\n\t\t}\n\n\tdefault:\n\t\tm.s.Log.Trace(logg.StringFunc(\n\t\t\tfunc() string {\n\t\t\t\treturn fmt.Sprintf(\"insert bundle: %q\", fi.Meta().Filename)\n\t\t\t},\n\t\t))\n\n\t\tpageSourceCount++\n\n\t\tpm, err := h.newPageMetaSourceFromFile(fi)\n\t\tif err != nil {\n\t\t\taddErr = fmt.Errorf(\"failed to create page meta from file %q: %w\", fi.Meta().Filename, err)\n\t\t\treturn\n\t\t}\n\n\t\tm.treePages.InsertWithLock(pm.pathInfo.Base(), pm)\n\t}\n\treturn\n}\n\nfunc (m *pageMap) addPagesFromGoTmplFi(fi hugofs.FileMetaInfo, buildConfig *BuildCfg) (pageCount uint64, resourceCount uint64, addErr error) {\n\tmeta := fi.Meta()\n\tpi := meta.PathInfo\n\n\tm.s.Log.Trace(logg.StringFunc(\n\t\tfunc() string {\n\t\t\treturn fmt.Sprintf(\"insert pages from data file: %q\", fi.Meta().Filename)\n\t\t},\n\t))\n","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/content_map.go#L295-L331","documentation":"Returned by pageMap.AddFi in the default branch (a page bundle / TypeFile that is a content file) when newPageMetaSourceFromFile fails while inserting the bundle's main page source into treePages. Distinct from 312: this is the page itself, not a bundled resource. Includes fi.Meta().Filename.","triggerScenarios":"A top-level/section content file (index.md, _index.md, or a section file) fails page-meta source construction — invalid front matter, bad draft date, unparseable path, unsupported output format config, or media-type mismatch.","commonSituations":"Content authors commit a page with broken front matter; a CMS export emits invalid YAML/TOML; a path containing characters the path parser rejects; content adapter (data-driven) pages with invalid PageConfigEarly; Hugo upgrade tightening front-matter validation.","solutions":["Open the file named in the message and fix the front matter (use `hugo --logLevel debug` to see the wrapped cause).","Validate the path does not contain characters rejected by the paths parser.","Confirm the page's listed output formats/media types exist in the site config.","For content-adapter pages, ensure PageConfigEarly compiles (valid dates, weights, paths)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func validatePageFile(path string) error {\n    fm, err := frontmatter.ParseFile(path)\n    if err != nil { return err }\n    return validatePageConfig(fm) // dates, weights, paths, output formats\n}","typeGuard":null,"tryCatchPattern":"if err := pageMap.AddFi(fi, cfg); err != nil {\n    if strings.Contains(err.Error(), \"failed to create page meta from file\") {\n        // unwrap to the newPageMetaSourceFromFile cause and fix front matter\n    }\n}","preventionTips":["Lint all /content front matter in CI before building.","Ensure output formats/media types referenced exist in config.","Watch for path characters the Hugo path parser rejects."],"tags":["page","bundle","front-matter","content-map","hugolib"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}