{"record":{"id":"5d34b17c89940100","repo":"gohugoio/hugo","slug":"insert-unknown-type-t","errorCode":null,"errorMessage":"Insert: unknown type %T","messagePattern":"Insert: unknown type %T","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"hugolib/content_map_page_contentnodeshifter.go","lineNumber":150,"sourceCode":"\t\tswitch new := new.(type) {\n\t\tcase contentNodeForSite:\n\t\t\toldp := vv[new.siteVector()]\n\t\t\tupdated := oldp != new\n\t\t\tif updated {\n\t\t\t\tresource.MarkStale(oldp)\n\t\t\t}\n\t\t\tvv[new.siteVector()] = new\n\t\t\treturn vv, oldp, updated\n\t\tdefault:\n\t\t\ts := make(contentNodes, 0, len(vv)+1)\n\t\t\tfor _, v := range vv {\n\t\t\t\ts = append(s, v)\n\t\t\t}\n\t\t\ts = append(s, new)\n\t\t\treturn s, vv, false\n\t\t}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Insert: unknown type %T\", old))\n\t}\n}\n\nfunc (s *contentNodeShifter) Shift(n contentNode, siteVector sitesmatrix.Vector, fallback bool) (contentNode, bool) {\n\tvar exact contentNode\n\tswitch v := n.(type) {\n\tcase contentNodeLookupContentNode:\n\t\texact = v.lookupContentNode(siteVector)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Shift: unknown type %T for %q\", n, n.Path()))\n\t}\n\n\tif exact != nil {\n\t\tif !fallback {\n\t\t\treturn exact, true\n\t\t}\n\t\t// If the exact match is backed by a file, return it directly.\n\t\tif wp, ok := exact.(contentNodeContentWeightProvider); ok && wp.contentWeight() > 0 {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/content_map_page_contentnodeshifter.go#L132-L168","documentation":"An internal panic in contentNodeShifter.Insert (hugolib/content_map_page_contentnodeshifter.go:150). Insert handles old nodes of type contentNodeSingle, contentNodes, and contentNodesMap; any other concrete type for 'old' reaches the default panic branch.","triggerScenarios":"Insert is called with an 'old' node whose type is not contentNodeSingle, contentNodes, or contentNodesMap — an internal contract violation.","commonSituations":"Hugo internal bug; a custom node type introduced without updating the shifter.","solutions":["Report a Hugo bug","Ensure inserted nodes conform to the recognized 'old' types","Upgrade Hugo"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Internal: ensure 'old' is a recognized type before Insert.\nswitch old.(type) {\ncase contentNodeSingle, contentNodes, contentNodesMap:\ndefault:\n    return errors.New(\"unrecognized old node type for Insert\")\n}","typeGuard":"func isInsertableOld(old contentNode) bool {\n    switch old.(type) {\n    case contentNodeSingle, contentNodes, contentNodesMap:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Validate old node types before inserting","Keep the shifter in sync with node type additions","Report Hugo bugs when this surfaces"],"tags":["hugolib","doctree","shifter","internal","panic"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}