{"id":"30a2c5bba47f1007","repo":"gohugoio/hugo","slug":"failed-to-create-page-from-pagemetasource-s-w","errorCode":null,"errorMessage":"failed to create page from pageMetaSource %s: %w","messagePattern":"failed to create page from pageMetaSource (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/content_map_page_assembler.go","lineNumber":357,"sourceCode":"\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"unexpected type %T\", v))\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// The common case.\n\t\tns = doctree.NodeTransformStateReplaced\n\n\t\thandleContentNodeSeq := func(v contentNodeSeq) (contentNode, doctree.NodeTransformState, error) {\n\t\t\tis := make(contentNodesMap)\n\t\t\tfor ms := range v {\n\t\t\t\t_, err := handlePageMetaSource(ms, is, false)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, 0, fmt.Errorf(\"failed to create page from pageMetaSource %s: %w\", s, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn is, ns, nil\n\t\t}\n\n\t\tswitch v := n.(type) {\n\t\tcase contentNodeSeq, contentNodes:\n\t\t\treturn handleContentNodeSeq(cnh.contentNodeToSeq(v))\n\t\tcase *pageMetaSource:\n\t\t\tn2, err = handlePageMetaSource(v, nil, false)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, 0, fmt.Errorf(\"failed to create page from pageMetaSource %s: %w\", s, err)\n\t\t\t}\n\t\t\treturn\n\t\tcase *pageState:\n\t\t\t// Nothing to do.\n\t\t\tns = doctree.NodeTransformStateNone\n\t\t\treturn v, ns, nil","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/hugolib/content_map_page_assembler.go#L339-L375","documentation":"Raised in hugolib/content_map_page_assembler.go:357 (and :369) during Hugo's page-assembly phase, wrapping an underlying failure from `handlePageMetaSource` — the step that turns a raw `pageMetaSource` (front matter + content source at a tree path) into a `pageState`. The `%s` is the content tree path; the wrapped error is the real cause, typically invalid front matter, a cascade/page-config validation error, or an output-format/kind problem.","triggerScenarios":"Any `hugo` build/server run where creating a page from its metadata source fails: unparseable or semantically invalid front matter (bad dates, invalid `outputs`, unknown kind), failing cascade application, or errors in early page-config decoding for a specific content file.","commonSituations":"A malformed front matter field in one content file (e.g. `date: not-a-date`), invalid values injected via `cascade` in a section's front matter or site config, or content produced by templates/imports with bad metadata; can appear after upgrading Hugo when previously-lenient front matter becomes an error.","solutions":["Read the wrapped error after the colon — it names the real cause — and note the path printed in the message to locate the offending content file.","Fix that file's front matter (dates, outputs, kind, params) or the cascade block that applies to it.","If it appeared after a Hugo upgrade, check the release notes for stricter front-matter/config validation and adjust the content accordingly."],"exampleFix":"# before (content/posts/foo.md)\n---\ntitle: Foo\ndate: 31/12/2025\n---\n\n# after\n---\ntitle: Foo\ndate: 2025-12-31\n---","handlingStrategy":"validation","validationCode":"hugo --printPathWarnings --logLevel debug  # surface bad front matter / paths before the assembler fails","typeGuard":null,"tryCatchPattern":"if err := hugolib.Build(...); err != nil {\n    // wrapped error: inspect the %w cause chain\n    log.Fatalf(\"page assembly failed: %v\", err) // message names the offending pageMetaSource path\n}","preventionTips":["The error names the source file — fix that content file's front matter (dates, cascade, slug/url) rather than retrying","Validate front matter (yamllint/toml check) in pre-commit for the content directory","Upgrade-test builds on a branch: assembler errors often come from spec changes between Hugo versions"],"tags":["hugo","build","front-matter","content"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}