{"record":{"id":"45c2b548bd3c3af9","repo":"gohugoio/hugo","slug":"failed-to-create-page-from-file-q-w","errorCode":null,"errorMessage":"failed to create page from file %q: %w","messagePattern":"failed to create page from file %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/content_map.go","lineNumber":263,"sourceCode":"\tif m == nil {\n\t\tpanic(\"nil pageMap\")\n\t}\n\n\th := m.s.h\n\n\tinsertResource := func(fim hugofs.FileMetaInfo) error {\n\t\tresourceSourceCount++\n\t\tpi := fi.Meta().PathInfo\n\t\tkey := pi.Base()\n\t\ttree := m.treeResources\n\n\t\ttree.Lock(true)\n\t\tdefer tree.Unlock(true)\n\n\t\tif pi.IsContent() {\n\t\t\tpm, err := h.newPageMetaSourceFromFile(fi)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to create page from file %q: %w\", fi.Meta().Filename, err)\n\t\t\t}\n\t\t\tpm.bundled = true\n\t\t\tm.treeResources.Insert(key, pm)\n\t\t} else {\n\t\t\tr := func() (hugio.ReadSeekCloser, error) {\n\t\t\t\treturn fim.Meta().Open()\n\t\t\t}\n\t\t\t// Create one dimension now, the rest later on demand.\n\t\t\trs := &resourceSource{path: pi, opener: r, fi: fim, sv: fim.Meta().SitesMatrix.VectorSample()}\n\t\t\tm.treeResources.Insert(key, rs)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tmeta := fi.Meta()\n\tpi := meta.PathInfo\n","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/content_map.go#L245-L281","documentation":"Returned inside pageMap.AddFi's insertResource closure when newPageMetaSourceFromFile fails for a file classified as TypeContentResource (a bundled content file inside a page bundle, e.g. a leaf bundle's attached .md). The filename from fi.Meta().Filename is included. This is the bundled-resource page-meta creation path.","triggerScenarios":"A file inside a page bundle (under /content/.../somebundle/) is content (IsContent() true) but its front matter or path metadata is invalid for newPageMetaSourceFromFile — bad date, invalid path info, unsupported media type, or malformed front matter that the page config compiler rejects.","commonSituations":"Adding a .md or other content file alongside a bundle's index with malformed front matter; a bundled content file with an extension Hugo parses but whose front matter is broken; renaming/moving bundle files leaving stale metadata; content adapter/generated content with invalid config.","solutions":["Open the file named in the error and validate its front matter (YAML/TOML syntax, required fields).","Check the path info / extension is a recognized content type in the site's mediaTypes config.","If the file is not meant to be a content resource, move it out of the bundle or give it a non-content extension.","Unwrap the %w to get the specific newPageMetaSourceFromFile cause and address that."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func validateBundledContent(fi hugofs.FileMetaInfo) error {\n    if !fi.Meta().PathInfo.IsContent() { return nil }\n    // parse front matter to catch errors before Hugo's AddFi\n    _, err := parseFrontMatterFromFile(fi.Meta().Filename)\n    return err\n}","typeGuard":"func isBundledContentResource(fi hugofs.FileMetaInfo) bool {\n    return !fi.IsDir() && fi.Meta().PathInfo != nil && fi.Meta().PathInfo.IsContent()\n}","tryCatchPattern":null,"preventionTips":["Validate front matter of bundled content files before build.","Keep non-content files out of page bundles or use non-content extensions.","Run `hugo --logLevel debug` to surface the wrapped newPageMetaSourceFromFile cause."],"tags":["page","bundle","resource","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"}