gohugoio/hugo · critical
Insert: unknown type %T
Error message
Insert: unknown type %T
What it means
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.
Source
Thrown at hugolib/content_map_page_contentnodeshifter.go:150
switch new := new.(type) {
case contentNodeForSite:
oldp := vv[new.siteVector()]
updated := oldp != new
if updated {
resource.MarkStale(oldp)
}
vv[new.siteVector()] = new
return vv, oldp, updated
default:
s := make(contentNodes, 0, len(vv)+1)
for _, v := range vv {
s = append(s, v)
}
s = append(s, new)
return s, vv, false
}
default:
panic(fmt.Sprintf("Insert: unknown type %T", old))
}
}
func (s *contentNodeShifter) Shift(n contentNode, siteVector sitesmatrix.Vector, fallback bool) (contentNode, bool) {
var exact contentNode
switch v := n.(type) {
case contentNodeLookupContentNode:
exact = v.lookupContentNode(siteVector)
default:
panic(fmt.Sprintf("Shift: unknown type %T for %q", n, n.Path()))
}
if exact != nil {
if !fallback {
return exact, true
}
// If the exact match is backed by a file, return it directly.
if wp, ok := exact.(contentNodeContentWeightProvider); ok && wp.contentWeight() > 0 {View on GitHub (pinned to 52c9bd7908)
Solutions
- Report a Hugo bug
- Ensure inserted nodes conform to the recognized 'old' types
- Upgrade Hugo
Defensive patterns
Strategy: type-guard
Validate before calling
// Internal: ensure 'old' is a recognized type before Insert.
switch old.(type) {
case contentNodeSingle, contentNodes, contentNodesMap:
default:
return errors.New("unrecognized old node type for Insert")
} Type guard
func isInsertableOld(old contentNode) bool {
switch old.(type) {
case contentNodeSingle, contentNodes, contentNodesMap:
return true
}
return false
} Prevention
- Validate old node types before inserting
- Keep the shifter in sync with node type additions
- Report Hugo bugs when this surfaces
When it happens
Trigger: Insert is called with an 'old' node whose type is not contentNodeSingle, contentNodes, or contentNodesMap — an internal contract violation.
Common situations: Hugo internal bug; a custom node type introduced without updating the shifter.
Related errors
- DeleteFunc: unknown type %T
- Shift: unknown type %T for %q
- contentNodeToContentNodesPage: unexpected type %T
- no vectors
- no site found for matrix %s
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/5d34b17c89940100.
Report an issue: GitHub.