{"record":{"id":"e93e3101e0a5e84e","repo":"gohugoio/hugo","slug":"failed-to-create-term-page-q-w","errorCode":null,"errorMessage":"failed to create term page %q: %w","messagePattern":"failed to create term page %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/content_map_page_assembler.go","lineNumber":873,"sourceCode":"\t\t\t\t\t\t},\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tp := &pageMetaSource{\n\t\t\t\t\t\tpathInfo:        pi,\n\t\t\t\t\t\tsitesMatrixBase: v,\n\t\t\t\t\t\tpageConfigSource: &pagemeta.PageConfigEarly{\n\t\t\t\t\t\t\tKind: kinds.KindTerm,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t\tvar n2 contentNode = p\n\t\t\t\t\tif found {\n\t\t\t\t\t\tn2 = contentNodes{n, p}\n\t\t\t\t\t}\n\t\t\t\t\tn2, ns, err := transformPages(termKey, n2, getCascades(pw.WalkContext, termKey))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"failed to create term page %q: %w\", termKey, err)\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch ns {\n\t\t\t\t\tcase doctree.NodeTransformStateReplaced:\n\t\t\t\t\t\tpw.Tree.InsertRaw(termKey, n2)\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t)\n\n\tpw.Transform = func(s string, n contentNode) (n2 contentNode, ns doctree.NodeTransformState, err error) {\n\t\tn2, ns, err = transformPagesAndCreateMissingStructuralNodes(s, n, false)\n\n\t\tif err != nil || ns >= doctree.NodeTransformStateSkip {\n\t\t\treturn","sourceCodeStart":855,"sourceCodeEnd":891,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/content_map_page_assembler.go#L855-L891","documentation":"Returned during the post-walk hook that creates missing taxonomy term pages, when transformPages fails for a synthesized term page (a term referenced by content but lacking its own _index.md). The termKey (base path of the term) is included. Hugo auto-creates term pages from seenTerms and this is where materialization of an auto term page fails.","triggerScenarios":"Content assigns a taxonomy term (e.g. tags: [foo]) but no term page exists, so Hugo synthesizes one; transformPages then fails for that synthesized pageMetaSource — invalid cascade, broken path, front-matter compilation error, or a sitesmatrix conflict for the term.","commonSituations":"A taxonomy term whose auto-generated page inherits a broken cascade/default; multilingual term with mismatched config across languages; content adapter referencing a term that triggers a failing template; taxonomy config change after content already references terms.","solutions":["Create an explicit term page (content/<taxonomy>/<term>/_index.md) to bypass auto-creation and control its front matter.","Unwrap %w to find the inner transform cause; the termKey identifies which term.","Review cascade/front-matter defaults applied to taxonomy term pages.","Check taxonomy config and multilingual consistency for the affected taxonomy."],"exampleFix":"# before: term 'foo' referenced but no page, auto-creation fails\ncontent/posts/a.md  ->  tags: [\"foo\"]\n# after: provide explicit term page\ncontent/tags/foo/_index.md","handlingStrategy":"validation","validationCode":"func ensureTermPage(taxonomy, term string) error {\n    p := filepath.Join(\"content\", taxonomy, term, \"_index.md\")\n    if _, err := os.Stat(p); os.IsNotExist(err) {\n        // pre-create to avoid auto-synthesis path; or validate cascade config\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := w.Walk(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to create term page\") {\n        // create explicit _index.md for the named termKey, then rebuild\n    }\n}","preventionTips":["Provide explicit term _index.md pages for terms you reference.","Keep taxonomy term cascade/front-matter defaults valid.","Verify multilingual taxonomy config consistency to avoid synthesis failures."],"tags":["taxonomy","term","transform","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"}