{"record":{"id":"cf956ceb6707d3ef","repo":"gohugoio/hugo","slug":"failed-to-find-internal-partial-decorator-template","errorCode":null,"errorMessage":"failed to find internal partial decorator template %q after insertion","messagePattern":"failed to find internal partial decorator template %q after insertion","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/tplimpl/templatetransform.go","lineNumber":346,"sourceCode":"\t\treturn\n\t}\n\n\t// See #14333. That is a very odd construct, but we need to guard against it.\n\tif c.hasBreakOrContinueOutsideRange(withNode.List) {\n\t\treturn\n\t}\n\tinnerHash := hashing.XxHashFromStringHexEncoded(c.t.Name() + withNodeInnerString)\n\tinternalPartialName := fmt.Sprintf(\"_partials/%s%s\", PartialDecoratorPrefix, innerHash)\n\n\tif c.lookupFn(internalPartialName, c.t) == nil {\n\t\tinnerCopy := withNode.List.CopyList()\n\t\tti, err := c.store.addTransformedTemplateInsert(internalPartialName, SubCategoryInline)\n\t\tif err != nil {\n\t\t\tc.err = fmt.Errorf(\"failed to create internal partial decorator template %q: %w\", internalPartialName, err)\n\t\t\treturn\n\t\t}\n\t\tif ti == nil {\n\t\t\tc.err = fmt.Errorf(\"failed to find internal partial decorator template %q after insertion\", internalPartialName)\n\t\t\treturn\n\t\t}\n\n\t\tcc := newTemplateTransformContext(ti, c.store, c.lookupFn)\n\n\t\ttree, err := c.store.addTransformedTemplateSetTree(ti, innerCopy)\n\t\tif err != nil {\n\t\t\tc.err = fmt.Errorf(\"failed to add internal partial decorator template %q: %w\", internalPartialName, err)\n\t\t\treturn\n\t\t}\n\n\t\tif err := cc.applyTransformationsAndSetReturnWrapper(tree); err != nil {\n\t\t\tc.err = fmt.Errorf(\"failed to transform internal partial decorator template %q: %w\", internalPartialName, err)\n\t\t\treturn\n\t\t}\n\n\t}\n","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/tplimpl/templatetransform.go#L328-L364","documentation":"After calling addTransformedTemplateInsert to register the decorator, Hugo expects a non-nil TemplInfo back (templatetransform.go:345-347). If the insertion reported success but returned nil template info — an invariant violation — this defensive error is raised. It guards against silent corruption of the template store during decorator synthesis.","triggerScenarios":"An internal inconsistency where addTransformedTemplateInsert returns (nil, nil) — no error but no template. This should not happen under normal control flow and indicates a logic bug in the store's insertion path.","commonSituations":"Not expected in normal builds. Would surface only from a Hugo internal regression or a heavily customized template pipeline.","solutions":["Treat as a Hugo internal bug; report with the internal partial name and a reproducer.","Update Hugo to the latest version.","Bisect templates/layouts to find a minimal trigger if reproducible."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Defensive: treat this invariant violation as a fatal internal bug:\nif err != nil && strings.Contains(err.Error(), \"failed to find internal partial decorator template\") {\n    panic(fmt.Sprintf(\"Hugo invariant violation: %v\", err))\n}","preventionTips":["Treat as a Hugo internal bug; report upstream.","Keep Hugo current.","Bisect templates to find a minimal reproducer."],"tags":["template","partial","decorator","internal","invariant","build"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}