{"record":{"id":"6229636fc30954b0","repo":"gohugoio/hugo","slug":"failed-to-calculate-hash-for-intsets-w","errorCode":null,"errorMessage":"failed to calculate hash for IntSets: %w","messagePattern":"failed to calculate hash for IntSets: %w","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"hugolib/sitesmatrix/vectorstores.go","lineNumber":710,"sourceCode":"\t\ts.versions = hmaps.NewOrderedIntSet()\n\t\tfor i := range cfg.ConfiguredVersions.ForEachIndex() {\n\t\t\ts.versions.Set(i)\n\t\t}\n\t}\n\tif s.roles == nil {\n\t\ts.roles = hmaps.NewOrderedIntSet()\n\t\tfor i := range cfg.ConfiguredRoles.ForEachIndex() {\n\t\t\ts.roles.Set(i)\n\t\t}\n\t}\n}\n\nfunc (s *IntSets) initHash() {\n\ts.h.once.Do(func() {\n\t\tvar err error\n\t\ts.h.hash, err = hashing.Hash(s.languages.Words(), s.versions.Words(), s.roles.Words())\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"failed to calculate hash for IntSets: %w\", err))\n\t\t}\n\t})\n}\n\nfunc (s *IntSets) init() *IntSets {\n\treturn s\n}\n\nfunc (s *IntSets) setDimensionsFromOtherIfNotSet(other VectorIterator) {\n\tif other == nil {\n\t\treturn\n\t}\n\tsetLang := s.languages == nil\n\tsetVer := s.versions == nil\n\tsetRole := s.roles == nil\n\n\tif !(setLang || setVer || setRole) {\n\t\treturn","sourceCodeStart":692,"sourceCodeEnd":728,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/sitesmatrix/vectorstores.go#L692-L728","documentation":"While lazily computing a structural hash over the IntSets (language/version/role word sets) via hashing.Hash, the underlying hashstructure call returned an error. Because this runs inside a sync.Once initialization (initHash, vectorstores.go:705-712), Hugo panics rather than returning, treating it as an unrecoverable invariant violation. The hash is used for caching keyed off the dimension sets.","triggerScenarios":"hashing.Hash fails on the word slices passed from s.languages/versions/roles.Words() — practically only if the hashing library cannot serialize a value (e.g. an unsupported type, cyclic structure, or a hash option misconfiguration). This is an internal failure, not a user-config error.","commonSituations":"A bug or regression in how dimension sets are populated (nil words, unexpected types); extremely rare under normal use; seen during development of new dimension types or after refactoring the IntSets population.","solutions":["Since this is a panic from internal state, report it as a Hugo bug with the stack trace and configuration.","Check for recent changes to dimension population code (config.ConfiguredRoles/Languages/Versions) that could pass an unhashable value.","As a temporary diagnostic, reduce the build to a single language/version/role to isolate which dimension's words trigger the failure.","Update Hugo to the latest version in case the hashing issue is already fixed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// No user-facing guard; the panic comes from internal hashing.\n// Defensive: ensure dimension word sets are non-nil and well-typed before init.\nfunc validateIntSets(s *IntSets) error {\n    if s.languages == nil || s.versions == nil || s.roles == nil {\n        return fmt.Errorf(\"IntSets dimensions not fully initialized\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Wrap internal calls in recover during development to capture the panic.\nfunc safeInitHash(s *IntSets) (err error) {\n    defer func() {\n        if r := recover(); r != nil {\n            err = fmt.Errorf(\"initHash panic: %v\", r)\n        }\n    }()\n    s.initHash()\n    return nil\n}","preventionTips":["Treat this panic as a bug to report upstream with a stack trace.","Keep Hugo updated; hashing regressions get fixed upstream.","Avoid passing custom/unhashable types into dimension word sets."],"tags":["sitesmatrix","panic","hashing","internal"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}