{"record":{"id":"0b935245b1f949b3","repo":"gohugoio/hugo","slug":"index-config-for-q-not-found","errorCode":null,"errorMessage":"index config for %q not found","messagePattern":"index config for %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"related/inverted_index.go","lineNumber":479,"sourceCode":"\tmatchm := make(map[Document]*rank, 200)\n\tdefer func() {\n\t\tfor _, r := range matchm {\n\t\t\tputRank(r)\n\t\t}\n\t}()\n\n\tapplyDateFilter := !idx.cfg.IncludeNewer && !upperDate.IsZero()\n\tvar fragmentsFilter collections.SortedStringSlice\n\n\tfor _, el := range query {\n\t\tsetm, found := idx.index[el.Index]\n\t\tif !found {\n\t\t\treturn []Document{}, fmt.Errorf(\"index for %q not found\", el.Index)\n\t\t}\n\n\t\tconfig, found := idx.getIndexCfg(el.Index)\n\t\tif !found {\n\t\t\treturn []Document{}, fmt.Errorf(\"index config for %q not found\", el.Index)\n\t\t}\n\n\t\tfor _, kw := range el.Keywords {\n\t\t\tif docs, found := setm[kw]; found {\n\t\t\t\tfor _, doc := range docs {\n\t\t\t\t\tif compare.Eq(doc, self) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif applyDateFilter {\n\t\t\t\t\t\t// Exclude newer than the limit given\n\t\t\t\t\t\tif doc.PublishDate().After(upperDate) {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif config.Type == TypeFragments && config.ApplyFilter {\n\t\t\t\t\t\tif fkw, ok := kw.(FragmentKeyword); ok {","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/related/inverted_index.go#L461-L497","documentation":"Returned by InvertedIndex.searchDate as a defensive check when getIndexCfg cannot find the IndexConfig for a query element's index name. Because searchDate is only called after Search resolves configs, reaching this branch indicates the config and the constructed index are out of sync -- the posting-list map has the index (527 passed) but the config slice does not.","triggerScenarios":"An index name exists as a key in idx.index (added at construction time) but idx.cfg.Indices no longer contains an IndexConfig with that Name -- e.g. config mutated after NewInvertedIndex, or a partial config reload.","commonSituations":"Runtime mutation of the related Config after the InvertedIndex was built; a custom integration that partially rebuilds config; concurrent config swap without recreating the index.","solutions":["Treat the related Config as immutable after NewInvertedIndex; rebuild the index if config changes.","Ensure NewInvertedIndex receives the fully-decoded, final Config.","Avoid sharing a Config value between index construction and later mutation."],"exampleFix":"// before: mutate cfg after building index\ncfg.Indices = append(cfg.Indices, newIndex)\nidx := related.NewInvertedIndex(cfg)\ncfg.Indices = cfg.Indices[:0]  // desync!\n\n// after: build once, never mutate\nfinalCfg := buildRelatedConfig()\nidx := related.NewInvertedIndex(finalCfg)","handlingStrategy":"validation","validationCode":"// Treat Config as immutable; rebuild index on change.\nfunc rebuildIndex(cfg related.Config) *related.InvertedIndex {\n    return related.NewInvertedIndex(cfg) // cfg must be final, never mutated after\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never mutate related.Config after passing it to NewInvertedIndex.","Keep idx.cfg.Indices and idx.index keys in sync by construction.","Avoid sharing a Config pointer between builder and runtime mutators."],"tags":["related","search","internal","config-sync"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}