{"record":{"id":"145cbd21b703eeed","repo":"gohugoio/hugo","slug":"unknown-item-type-t","errorCode":null,"errorMessage":"unknown item type %T","messagePattern":"unknown item type %T","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"hugolib/page__content.go","lineNumber":260,"sourceCode":"\t\t\t\tif !found {\n\t\t\t\t\t// This should never happen.\n\t\t\t\t\tpanic(fmt.Sprintf(\"rendered shortcode %q not found\", v.placeholder))\n\t\t\t\t}\n\n\t\t\t\tb, more, err := renderedShortcode.renderShortcode(ctx)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil, false, fmt.Errorf(\"failed to render shortcode: %w\", err)\n\t\t\t\t}\n\t\t\t\thasVariants = hasVariants || more\n\t\t\t\tc = append(c, []byte(b)...)\n\n\t\t\t} else {\n\t\t\t\t// Insert the placeholder so we can insert the content after\n\t\t\t\t// markdown processing.\n\t\t\t\tc = append(c, []byte(v.placeholder)...)\n\t\t\t}\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unknown item type %T\", it))\n\t\t}\n\t}\n\n\treturn c, sm, hasVariants, nil\n}\n\nfunc (c *cachedContent) IsZero() bool {\n\treturn len(c.pi.itemsStep2) == 0\n}\n\nfunc (pi *contentParseInfo) parseSource(source []byte, skipFrontMatter bool) error {\n\tif len(pi.itemsStep1) == 0 {\n\t\treturn nil\n\t}\n\n\ts := pi.shortcodeParseInfo\n\n\tfail := func(err error, i pageparser.Item) error {","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page__content.go#L242-L278","documentation":"Panic in the content source-map assembly loop: an item 'it' in the parsed content items is neither a pageparser.Item, a pageContentReplacement, nor a *shortcode. The switch's default branch panics with the item's Go type, indicating an unexpected item type reached the assembler — an internal invariant failure in the page parser pipeline.","triggerScenarios":"The page parser emitted an item of a type the assembler does not handle. Caused by an internal change to the parser item types that did not update the assembler's type switch, or by injecting a non-standard item into the items slice (fork). Reachable only via internal bugs.","commonSituations":"Hugo version mismatch between parser and assembler. A fork adding new item types without updating the switch. A corrupted/edge-case content file that the parser mishandles.","solutions":["Upgrade Hugo to a release where parser and assembler are consistent.","If hit, capture the %T type from the panic and report a Hugo issue with the content file.","Clean-rebuild to rule out stale parsed content.","If forking, add the new item type to the switch in page__content.go around line 230."],"exampleFix":"// before (fork): new item type unhandled\ncase pageparser.Item: ...\ndefault: panic(\"unknown item type %T\")\n\n// after: handle the new type\ncase myCustomItem:\n    sm = append(sm, ...)\ncase pageparser.Item: ...","handlingStrategy":"validation","validationCode":"// Internal invariant — parser/assembler type mismatch.\n// Mitigate: upgrade Hugo; clean-rebuild; capture the %T type from the panic for the bug report.","typeGuard":null,"tryCatchPattern":"// Wrap Build in recover() to capture the item type (see 781).","preventionTips":["Keep parser and assembler from the same Hugo version.","If forking, extend the type switch in page__content.go.","Clean-rebuild to rule out stale parsed content.","Report the item type upstream."],"tags":["content","parser","rendering","panic","internal-invariant"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}