{"record":{"id":"d37ef7e93b7e48ae","repo":"gohugoio/hugo","slug":"shift-unknown-type-t-for-q","errorCode":null,"errorMessage":"Shift: unknown type %T for %q","messagePattern":"Shift: unknown type %T for %q","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"hugolib/content_map_page_contentnodeshifter.go","lineNumber":160,"sourceCode":"\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 {\n\t\t\treturn exact, true\n\t\t}\n\t\t// The exact match is an auto page (not backed by a file).\n\t\t// Check if there's a file-backed complement that should take precedence.\n\t\tif vvv := cnh.findContentNodeForSiteVector(siteVector, fallback, cnh.contentNodeToSeq(n)); vvv != nil {\n\t\t\treturn vvv, true\n\t\t}\n\t\treturn exact, true\n\t}\n","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/content_map_page_contentnodeshifter.go#L142-L178","documentation":"An internal panic in contentNodeShifter.Shift (hugolib/content_map_page_contentnodeshifter.go:160) when the node does not implement contentNodeLookupContentNode. The %T prints the node type and %q prints its Path() so the offending node is identifiable.","triggerScenarios":"Shift receives a node that does not implement contentNodeLookupContentNode — an internal contract violation during dimension shifting.","commonSituations":"Hugo internal bug; a custom node type lacking the required interface.","solutions":["Report a Hugo bug with the path shown in the panic","Ensure all shiftable nodes implement contentNodeLookupContentNode","Upgrade Hugo"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Internal: ensure n implements contentNodeLookupContentNode before Shift.\nif _, ok := n.(contentNodeLookupContentNode); !ok {\n    return nil, false\n}","typeGuard":"func isShiftable(n contentNode) bool {\n    _, ok := n.(contentNodeLookupContentNode)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Ensure shiftable nodes implement contentNodeLookupContentNode","Type-check before calling Shift on dynamic node types","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"}