{"record":{"id":"89eeadc10cdd8a5d","repo":"gohugoio/hugo","slug":"nil-deps-on-site","errorCode":null,"errorMessage":"nil deps on site","messagePattern":"nil deps on site","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"hugolib/hugo_sites_build.go","lineNumber":1350,"sourceCode":"\t\t\ts := p.Site.(*Site)\n\t\t\ts.handleContentAdapterChanges(bi, buildConfig)\n\t\t\treturn nil\n\t\t},\n\t})\n\n\th.pageTrees.treePagesFromTemplateAdapters.WalkPrefixRaw(doctree.LockTypeRead, \"\", func(key string, p *pagesfromdata.PagesFromTemplate) (bool, error) {\n\t\tif p.StaleVersion() > 0 {\n\t\t\tg.Enqueue(p)\n\t\t}\n\t\treturn false, nil\n\t})\n\n\treturn g.Wait()\n}\n\nfunc (s *HugoSites) processFiles(ctx context.Context, l logg.LevelLogger, buildConfig *BuildCfg, filenames ...pathChange) error {\n\tif s.Deps == nil {\n\t\tpanic(\"nil deps on site\")\n\t}\n\n\tsourceSpec := source.NewSourceSpec(s.PathSpec, buildConfig.ContentInclusionFilter, s.BaseFs.Content.Fs)\n\n\t// For inserts, we can pick an arbitrary pageMap.\n\tpageMap := s.Sites[0].pageMap\n\n\tc := newPagesCollector(ctx, s.h, sourceSpec, s.Log, l, pageMap, buildConfig, filenames)\n\n\tif err := c.Collect(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":1332,"sourceCodeEnd":1366,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/hugo_sites_build.go#L1332-L1366","documentation":"Panic at the start of processFiles when s.Deps is nil. This method processes content files into the page map and needs the dependency container; like error 780 it guards against a half-initialized HugoSites. It is a redundant invariant check on a different code path within the build.","triggerScenarios":"processFiles is invoked during build but Deps was cleared or never set on the HugoSites. Constructing HugoSites manually or niling Deps between operations. Reaching processFiles from a non-standard caller.","commonSituations":"Embedding Hugo and reusing a HugoSites object after manually tearing down its dependencies. Test harnesses that bypass full init. State cleanup logic that over-nils shared containers.","solutions":["Always construct HugoSites via LoadConfig/NewHugoSites so Deps is populated.","Never nil h.Deps; create a fresh HugoSites for a reconfiguration instead.","In tests, use the provided integration-test builders.","Add a precondition assertion in your wrapper before triggering a build."],"exampleFix":"// before\nsite := &HugoSites{}\nsite.processFiles(ctx, l, cfg, changes...) // panic: nil deps on site\n\n// after\nsite, err := hugolib.NewHugoSitesFromConfig(d, cfg)\nif err != nil { return err }\nsite.processFiles(ctx, l, cfg, changes...)","handlingStrategy":"validation","validationCode":"// Same as 780: ensure Deps is populated via standard init before any build that reaches processFiles.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Construct HugoSites through LoadConfig/NewHugoSites.","Never nil h.Deps; recreate the object for reconfiguration.","Use integration-test builders in tests.","Treat nil Deps as a programming bug."],"tags":["initialization","deps","build","panic","internal-invariant"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}