{"record":{"id":"15e38d9ab9e67615","repo":"gohugoio/hugo","slug":"transformerraw-is-required","errorCode":null,"errorMessage":"transformerRaw is required","messagePattern":"transformerRaw is required","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"hugolib/doctree/nodeshifttree.go","lineNumber":310,"sourceCode":"func (r *NodeShiftTree[T]) LongestPrefixRaw(s string) (string, bool) {\n\ts, _, found := r.tree.LongestPrefix(s)\n\treturn s, found\n}\n\n// GetRaw returns the raw value at the given key without any shifting or transformation.\nfunc (r *NodeShiftTree[T]) GetRaw(s string) (T, bool) {\n\tv, ok := r.tree.Get(s)\n\tif !ok {\n\t\tvar t T\n\t\treturn t, false\n\t}\n\treturn v, true\n}\n\n// AppendRaw appends ts to the node at the given key without any shifting or transformation.\nfunc (r *NodeShiftTree[T]) AppendRaw(s string, ts ...T) (T, bool) {\n\tif r.transformerRaw == nil {\n\t\tpanic(\"transformerRaw is required\")\n\t}\n\tn, found := r.GetRaw(s)\n\tn2, replaced := r.transformerRaw.Append(n, ts...)\n\tif replaced || !found {\n\t\tr.insert(s, n2)\n\t}\n\treturn n2, replaced || !found\n}\n\n// WalkPrefixRaw walks all nodes with the given prefix in the tree without any shifting or transformation.\nfunc (r *NodeShiftTree[T]) WalkPrefixRaw(prefix string, fn radix.WalkFn[T]) error {\n\treturn r.tree.WalkPrefix(prefix, fn)\n}\n\n// Shape returns a new NodeShiftTree shaped to the given dimension.\nfunc (t *NodeShiftTree[T]) Shape(v sitesmatrix.Vector) *NodeShiftTree[T] {\n\tx := t.clone()\n\tx.siteVector = v","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/doctree/nodeshifttree.go#L292-L328","documentation":"A panic in NodeShiftTree.AppendRaw (hugolib/doctree/nodeshifttree.go:310) when transformerRaw is nil. AppendRaw needs a Transformer to combine values, so a tree constructed without TransformerRaw cannot service AppendRaw calls.","triggerScenarios":"Constructing a NodeShiftTree with Config.TransformerRaw nil and then calling AppendRaw.","commonSituations":"Embedded Hugo use that builds a tree for read-only/shift operations but then calls AppendRaw on it.","solutions":["Provide a TransformerRaw in Config if you need AppendRaw","Use Insert/InsertRaw instead, which do not require transformerRaw"],"exampleFix":"// before\ntree := doctree.New(t)\n// after\ntree := doctree.New(doctree.Config{Shifter: s, TransformerRaw: tr})","handlingStrategy":"validation","validationCode":"if tree.transformerRaw == nil {\n    return errors.New(\"AppendRaw requires a TransformerRaw\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide TransformerRaw in Config if you intend to use AppendRaw","Use Insert/InsertRaw for cases that do not need a transformer","Document tree capabilities based on which Config fields are set"],"tags":["doctree","api-misuse","panic"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}